<!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>[168055] 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/168055">168055</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2014-04-30 15:57:08 -0700 (Wed, 30 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Updated ANGLE.
https://bugs.webkit.org/show_bug.cgi?id=132367
<rdar://problem/16211451>
Reviewed by Dean Jackson.
Source/ThirdParty/ANGLE:
* ANGLE.plist:
Updated and xml encoded.
* ANGLE.xcodeproj/project.pbxproj:
Added needed new source files.
* changes.diff:
Added to keep track of differences between WebKit's copy of ANGLE and the master repository.
Updated ANGLE source files to e7a453a5bd76705ccb151117fa844846d4aa90af. Long list of changes omitted.
Source/WebCore:
* CMakeLists.txt
Fixed ANGLE compiling with the update.
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
Removed SH_MAP_LONG_VARIABLE_NAMES which is no longer defined in ANGLE.
See https://chromium.googlesource.com/angle/angle/+/3cdfcce86b38ef31a0afd71855887193a7924468
* platform/graphics/opengl/Extensions3DOpenGLES.h:
* platform/graphics/opengl/Extensions3DOpenGLES.cpp:
Updated type names from 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="#trunkSourceThirdPartyANGLEcodereviewsettings">trunk/Source/ThirdParty/ANGLE/codereview.settings</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="#trunkSourceThirdPartyANGLEincludeGLES2gl2h">trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeGLES2gl2exth">trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeGLSLANGShaderLangh">trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcbuild_anglegyp">trunk/Source/ThirdParty/ANGLE/src/build_angle.gyp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonRefCountObjecth">trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.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="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveParsercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsery">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y</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="#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="#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="#trunkSourceThirdPartyANGLEsrccompilertranslatorDetectCallDepthh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.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="#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="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp</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="#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="#trunkSourceThirdPartyANGLEsrccompilertranslatorQualifierAlivecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveTreecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorShHandleh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.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="#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="#trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitASTcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp</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="#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="#trunkSourceThirdPartyANGLEsrccompilertranslatorVersionGLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorgenerate_parsersh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/generate_parser.sh</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="#trunkSourceThirdPartyANGLEsrccompilertranslatorlocalintermediateh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorossource_wincpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorparseConstcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictFragmentShaderTimingcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictFragmentShaderTimingh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictVertexShaderTimingcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictVertexShaderTimingh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLConfigcpp">trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp</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="#trunkSourceThirdPartyANGLEsrclibEGLlibEGLcpp">trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp</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="#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="#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="#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="#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="#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="#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="#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="#trunkSourceThirdPartyANGLEsrclibGLESv2angletypesh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h</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="#trunkSourceThirdPartyANGLEsrclibGLESv2mainh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2precompiledh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererBufferStoragecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererBufferStorageh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererFenceImplh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/FenceImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererImagecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererImageh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexBuffercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexBuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexDataManagercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexDataManager.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexRangeCachecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexRangeCacheh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererRenderTargeth">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/RenderTarget.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererRenderercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererRendererh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererShaderExecutableh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/ShaderExecutable.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererTextureStoragecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererTextureStorageh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexBuffercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexBufferh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexDataManagercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexDataManagerh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11BufferStorage11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11BufferStorage11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Fence11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Fence11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Image11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Image11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11IndexBuffer11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11InputLayoutCachecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11InputLayoutCacheh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Query11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Query11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderStateCachecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderStateCacheh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderTarget11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderTarget11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Renderer11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Renderer11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11ShaderExecutable11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11ShaderExecutable11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11SwapChain11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11SwapChain11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11TextureStorage11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11TextureStorage11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11VertexBuffer11cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11VertexBuffer11h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11renderer11_utilscpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11renderer11_utilsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11shadersClear11hlsl">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11shadersgenerate_shadersbat">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9BufferStorage9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9BufferStorage9h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Fence9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Fence9h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Image9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Image9h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9IndexBuffer9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Query9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Query9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9RenderTarget9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9RenderTarget9h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Renderer9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Renderer9h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9ShaderExecutable9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9SwapChain9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/SwapChain9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9TextureStorage9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9TextureStorage9h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9VertexBuffer9cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9VertexBuffer9h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9VertexDeclarationCachecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9renderer9_utilscpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9renderer9_utilsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shadersBlitps">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/Blit.ps</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledcomponentmaskpsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledflipyvsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledluminancepsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledpassthroughpsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledstandardvsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shadersgenerate_shadersbat">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2renderergeneratemiph">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/generatemip.h</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="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLCommoncpp">trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLEScpp">trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLESh">trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEchangesdiff">trunk/Source/ThirdParty/ANGLE/changes.diff</a></li>
<li>trunk/Source/ThirdParty/ANGLE/include/GLES3/</li>
<li><a href="#trunkSourceThirdPartyANGLEincludeGLES3gl3h">trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeGLES3gl3exth">trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3ext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeGLES3gl3platformh">trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3platform.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="#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="#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="#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="#trunkSourceThirdPartyANGLEsrccompilertranslator64bitlexersafetypatch">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorFlagStd140Structscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorFlagStd140Structsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h</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="#trunkSourceThirdPartyANGLEsrccompilertranslatorValidateOutputscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorValidateOutputsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorlength_limitsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.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="#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="#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="#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="#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="#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="#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><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2renderercopyimagecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2renderercopyimageh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2renderercopyvertexh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyvertex.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3dHLSLCompilercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3dHLSLCompilerh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11shadersPassthrough2D11hlsl">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorMapLongVariableNamescpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorMapLongVariableNamesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Constantsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Constants.h</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBaseTypesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorCommonh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorQualifierAlivecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitASTcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorVariableInfocpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorglslangl">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l</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="#trunkSourceThirdPartyANGLEsrccompilertranslatorintermOutcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorlocalintermediateh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorossource_wincpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partymurmurhashMurmurHash3cpp">trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp</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 (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/ANGLE.plist        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/ANGLE.plist        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -2,21 +2,21 @@
</span><span class="cx"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
</span><span class="cx"> <plist version="1.0">
</span><span class="cx"> <array>
</span><del>-        <dict>
-                <key>OpenSourceProject</key>
-                <string>ANGLE</string>
-                <key>OpenSourceVersion</key>
-                <string>836bd2176e5607b14846cf1fbc5932dbc91318f4</string>
-                <key>OpenSourceWebsiteURL</key>
-                <string>http://code.google.com/p/angleproject/</string>
-                <key>OpenSourceSCM</key>
-                <string>git clone https://code.google.com/p/angleproject/ && cd angleproject && git checkout 836bd2176e5607b14846cf1fbc5932dbc91318f4</string>
-                <key>OpenSourceImportDate</key>
-                <string>2014-02-18</string>
-                <key>OpenSourceLicense</key>
-                <string>BSD</string>
-                <key>OpenSourceLicenseFile</key>
-                <string>ANGLE.txt</string>
-        </dict>
</del><ins>+ <dict>
+ <key>OpenSourceProject</key>
+ <string>ANGLE</string>
+ <key>OpenSourceVersion</key>
+ <string>e7a453a5bd76705ccb151117fa844846d4aa90af</string>
+ <key>OpenSourceWebsiteURL</key>
+ <string>http://code.google.com/p/angleproject/</string>
+ <key>OpenSourceSCM</key>
+ <string>git clone https://chromium.googlesource.com/angle/angle &amp;&amp; cd angle &amp;&amp; git checkout e7a453a5bd76705ccb151117fa844846d4aa90af</string>
+ <key>OpenSourceImportDate</key>
+ <string>2014-04-29</string>
+ <key>OpenSourceLicense</key>
+ <string>BSD</string>
+ <key>OpenSourceLicenseFile</key>
+ <string>ANGLE.txt</string>
+ </dict>
</ins><span class="cx"> </array>
</span><span class="cx"> </plist>
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEANGLExcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -67,8 +67,6 @@
</span><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><span class="cx">                 31012E4318B97B9B0039062F /* localintermediate.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD318B97B9B0039062F /* localintermediate.h */; };
</span><del>-                31012E4418B97B9B0039062F /* MapLongVariableNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DD418B97B9B0039062F /* MapLongVariableNames.cpp */; };
-                31012E4518B97B9B0039062F /* MapLongVariableNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD518B97B9B0039062F /* MapLongVariableNames.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><span class="cx">                 31012E4818B97B9B0039062F /* osinclude.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD818B97B9B0039062F /* osinclude.h */; };
</span><span class="lines">@@ -115,8 +113,6 @@
</span><span class="cx">                 31012E7218B97B9B0039062F /* UnfoldShortCircuit.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E0318B97B9B0039062F /* UnfoldShortCircuit.h */; };
</span><span class="cx">                 31012E7318B97B9B0039062F /* UnfoldShortCircuitAST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012E0418B97B9B0039062F /* UnfoldShortCircuitAST.cpp */; };
</span><span class="cx">                 31012E7418B97B9B0039062F /* UnfoldShortCircuitAST.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E0518B97B9B0039062F /* UnfoldShortCircuitAST.h */; };
</span><del>-                31012E7518B97B9B0039062F /* Uniform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012E0618B97B9B0039062F /* Uniform.cpp */; };
-                31012E7618B97B9B0039062F /* Uniform.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E0718B97B9B0039062F /* Uniform.h */; };
</del><span class="cx">                 31012E7718B97B9B0039062F /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012E0818B97B9B0039062F /* util.cpp */; };
</span><span class="cx">                 31012E7818B97B9B0039062F /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E0918B97B9B0039062F /* util.h */; };
</span><span class="cx">                 31012E7918B97B9B0039062F /* ValidateLimitations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012E0A18B97B9B0039062F /* ValidateLimitations.cpp */; };
</span><span class="lines">@@ -131,7 +127,30 @@
</span><span class="cx">                 31012E8418B97C860039062F /* compilerdebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E8218B97C860039062F /* compilerdebug.h */; };
</span><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><del>-                49951C0314B7AAB30060E96E /* length_limits.h in Headers */ = {isa = PBXBuildFile; fileRef = 49951C0214B7AAB30060E96E /* length_limits.h */; };
</del><ins>+                5C9FFF4E19102A000025B8FA /* FlagStd140Structs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9FFF4C19102A000025B8FA /* FlagStd140Structs.cpp */; };
+                5C9FFF4F19102A000025B8FA /* FlagStd140Structs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9FFF4D19102A000025B8FA /* FlagStd140Structs.h */; };
+                5CC7D452191024E4000B8C1F /* LoopInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D44B191024E3000B8C1F /* LoopInfo.cpp */; };
+                5CC7D453191024E4000B8C1F /* LoopInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D44C191024E4000B8C1F /* LoopInfo.h */; };
+                5CC7D456191024E4000B8C1F /* Uniform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D44F191024E4000B8C1F /* Uniform.cpp */; };
+                5CC7D457191024E4000B8C1F /* ValidateOutputs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D450191024E4000B8C1F /* ValidateOutputs.cpp */; };
+                5CC7D458191024E4000B8C1F /* ValidateOutputs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D451191024E4000B8C1F /* ValidateOutputs.h */; };
+                5CC7D46B19102620000B8C1F /* angleutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D45A19102620000B8C1F /* angleutils.h */; };
+                5CC7D46C19102620000B8C1F /* blocklayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D45B19102620000B8C1F /* blocklayout.cpp */; };
+                5CC7D46D19102620000B8C1F /* blocklayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D45C19102620000B8C1F /* blocklayout.h */; };
+                5CC7D46E19102621000B8C1F /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D45D19102620000B8C1F /* debug.cpp */; };
+                5CC7D46F19102621000B8C1F /* debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D45E19102620000B8C1F /* debug.h */; };
+                5CC7D47019102621000B8C1F /* event_tracer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D45F19102620000B8C1F /* event_tracer.cpp */; };
+                5CC7D47119102621000B8C1F /* event_tracer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46019102620000B8C1F /* event_tracer.h */; };
+                5CC7D47219102621000B8C1F /* mathutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D46119102620000B8C1F /* mathutil.cpp */; };
+                5CC7D47319102621000B8C1F /* mathutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46219102620000B8C1F /* mathutil.h */; };
+                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 */; };
+                5CC7D47919102621000B8C1F /* utilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D46819102620000B8C1F /* utilities.cpp */; };
+                5CC7D47A19102621000B8C1F /* utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46919102620000B8C1F /* utilities.h */; };
+                5CC7D47B19102621000B8C1F /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46A19102620000B8C1F /* version.h */; };
</ins><span class="cx">                 72309A56183C27DE00370B93 /* Tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72309A55183C27DB00370B93 /* Tokenizer.cpp */; };
</span><span class="cx">                 72309A58183C27F300370B93 /* ExpressionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72309A57183C27F100370B93 /* ExpressionParser.cpp */; };
</span><span class="cx">                 A08C3CDC16D6CB61003F0B83 /* ArrayBoundsClamper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A08C3CDA16D6CB61003F0B83 /* ArrayBoundsClamper.cpp */; };
</span><span class="lines">@@ -243,8 +262,6 @@
</span><span class="cx">                 31012DD118B97B9B0039062F /* intermOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 31012DD218B97B9B0039062F /* IntermTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 31012DD318B97B9B0039062F /* localintermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = "<group>"; };
</span><del>-                31012DD418B97B9B0039062F /* MapLongVariableNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MapLongVariableNames.cpp; sourceTree = "<group>"; };
-                31012DD518B97B9B0039062F /* MapLongVariableNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapLongVariableNames.h; sourceTree = "<group>"; };
</del><span class="cx">                 31012DD618B97B9B0039062F /* MMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMap.h; sourceTree = "<group>"; };
</span><span class="cx">                 31012DD718B97B9B0039062F /* NodeSearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeSearch.h; sourceTree = "<group>"; };
</span><span class="cx">                 31012DD818B97B9B0039062F /* osinclude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -291,8 +308,6 @@
</span><span class="cx">                 31012E0318B97B9B0039062F /* UnfoldShortCircuit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnfoldShortCircuit.h; sourceTree = "<group>"; };
</span><span class="cx">                 31012E0418B97B9B0039062F /* UnfoldShortCircuitAST.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnfoldShortCircuitAST.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 31012E0518B97B9B0039062F /* UnfoldShortCircuitAST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnfoldShortCircuitAST.h; sourceTree = "<group>"; };
</span><del>-                31012E0618B97B9B0039062F /* Uniform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Uniform.cpp; sourceTree = "<group>"; };
-                31012E0718B97B9B0039062F /* Uniform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uniform.h; sourceTree = "<group>"; };
</del><span class="cx">                 31012E0818B97B9B0039062F /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 31012E0918B97B9B0039062F /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
</span><span class="cx">                 31012E0A18B97B9B0039062F /* ValidateLimitations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValidateLimitations.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -308,7 +323,30 @@
</span><span class="cx">                 312BDB0915FEC91E0097EBC7 /* ANGLE.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ANGLE.plist; sourceTree = "<group>"; };
</span><span class="cx">                 312BDB0A15FECA3A0097EBC7 /* ANGLE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ANGLE.txt; sourceTree = "<group>"; };
</span><span class="cx">                 443A3E1512ECF6CC0004F9D7 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
</span><del>-                49951C0214B7AAB30060E96E /* length_limits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = length_limits.h; sourceTree = "<group>"; };
</del><ins>+                5C9FFF4C19102A000025B8FA /* FlagStd140Structs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FlagStd140Structs.cpp; sourceTree = "<group>"; };
+                5C9FFF4D19102A000025B8FA /* FlagStd140Structs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlagStd140Structs.h; sourceTree = "<group>"; };
+                5CC7D44B191024E3000B8C1F /* LoopInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoopInfo.cpp; sourceTree = "<group>"; };
+                5CC7D44C191024E4000B8C1F /* LoopInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoopInfo.h; sourceTree = "<group>"; };
+                5CC7D44F191024E4000B8C1F /* Uniform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Uniform.cpp; sourceTree = "<group>"; };
+                5CC7D450191024E4000B8C1F /* ValidateOutputs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValidateOutputs.cpp; sourceTree = "<group>"; };
+                5CC7D451191024E4000B8C1F /* ValidateOutputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidateOutputs.h; sourceTree = "<group>"; };
+                5CC7D45A19102620000B8C1F /* angleutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = angleutils.h; path = src/common/angleutils.h; sourceTree = "<group>"; };
+                5CC7D45B19102620000B8C1F /* blocklayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = blocklayout.cpp; path = src/common/blocklayout.cpp; sourceTree = "<group>"; };
+                5CC7D45C19102620000B8C1F /* blocklayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blocklayout.h; path = src/common/blocklayout.h; sourceTree = "<group>"; };
+                5CC7D45D19102620000B8C1F /* debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = debug.cpp; path = src/common/debug.cpp; sourceTree = "<group>"; };
+                5CC7D45E19102620000B8C1F /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = debug.h; path = src/common/debug.h; sourceTree = "<group>"; };
+                5CC7D45F19102620000B8C1F /* event_tracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = event_tracer.cpp; path = src/common/event_tracer.cpp; sourceTree = "<group>"; };
+                5CC7D46019102620000B8C1F /* event_tracer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = event_tracer.h; path = src/common/event_tracer.h; sourceTree = "<group>"; };
+                5CC7D46119102620000B8C1F /* mathutil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathutil.cpp; path = src/common/mathutil.cpp; sourceTree = "<group>"; };
+                5CC7D46219102620000B8C1F /* mathutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathutil.h; path = src/common/mathutil.h; sourceTree = "<group>"; };
+                5CC7D46319102620000B8C1F /* RefCountObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RefCountObject.cpp; path = src/common/RefCountObject.cpp; sourceTree = "<group>"; };
+                5CC7D46419102620000B8C1F /* RefCountObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RefCountObject.h; path = src/common/RefCountObject.h; sourceTree = "<group>"; };
+                5CC7D46519102620000B8C1F /* shadervars.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = shadervars.cpp; path = src/common/shadervars.cpp; sourceTree = "<group>"; };
+                5CC7D46619102620000B8C1F /* shadervars.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = shadervars.h; path = src/common/shadervars.h; sourceTree = "<group>"; };
+                5CC7D46719102620000B8C1F /* system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = system.h; path = src/common/system.h; sourceTree = "<group>"; };
+                5CC7D46819102620000B8C1F /* utilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utilities.cpp; path = src/common/utilities.cpp; sourceTree = "<group>"; };
+                5CC7D46919102620000B8C1F /* utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utilities.h; path = src/common/utilities.h; sourceTree = "<group>"; };
+                5CC7D46A19102620000B8C1F /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = version.h; path = src/common/version.h; sourceTree = "<group>"; };
</ins><span class="cx">                 5D7C59C51208C68B001C873E /* ANGLE.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ANGLE.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 5D7C59C61208C68B001C873E /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 5D7C59C71208C68B001C873E /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
</span><span class="lines">@@ -358,6 +396,13 @@
</span><span class="cx">                 31012D9F18B97B9B0039062F /* translator */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                5C9FFF4C19102A000025B8FA /* FlagStd140Structs.cpp */,
+                                5C9FFF4D19102A000025B8FA /* FlagStd140Structs.h */,
+                                5CC7D44B191024E3000B8C1F /* LoopInfo.cpp */,
+                                5CC7D44C191024E4000B8C1F /* LoopInfo.h */,
+                                5CC7D44F191024E4000B8C1F /* Uniform.cpp */,
+                                5CC7D450191024E4000B8C1F /* ValidateOutputs.cpp */,
+                                5CC7D451191024E4000B8C1F /* ValidateOutputs.h */,
</ins><span class="cx">                                 31012DA918B97B9B0039062F /* depgraph */,
</span><span class="cx">                                 31012DF618B97B9B0039062F /* timing */,
</span><span class="cx">                                 31012DA018B97B9B0039062F /* BaseTypes.h */,
</span><span class="lines">@@ -401,8 +446,6 @@
</span><span class="cx">                                 31012DD118B97B9B0039062F /* intermOut.cpp */,
</span><span class="cx">                                 31012DD218B97B9B0039062F /* IntermTraverse.cpp */,
</span><span class="cx">                                 31012DD318B97B9B0039062F /* localintermediate.h */,
</span><del>-                                31012DD418B97B9B0039062F /* MapLongVariableNames.cpp */,
-                                31012DD518B97B9B0039062F /* MapLongVariableNames.h */,
</del><span class="cx">                                 31012DD618B97B9B0039062F /* MMap.h */,
</span><span class="cx">                                 31012DD718B97B9B0039062F /* NodeSearch.h */,
</span><span class="cx">                                 31012DD818B97B9B0039062F /* osinclude.h */,
</span><span class="lines">@@ -445,8 +488,6 @@
</span><span class="cx">                                 31012E0318B97B9B0039062F /* UnfoldShortCircuit.h */,
</span><span class="cx">                                 31012E0418B97B9B0039062F /* UnfoldShortCircuitAST.cpp */,
</span><span class="cx">                                 31012E0518B97B9B0039062F /* UnfoldShortCircuitAST.h */,
</span><del>-                                31012E0618B97B9B0039062F /* Uniform.cpp */,
-                                31012E0718B97B9B0039062F /* Uniform.h */,
</del><span class="cx">                                 31012E0818B97B9B0039062F /* util.cpp */,
</span><span class="cx">                                 31012E0918B97B9B0039062F /* util.h */,
</span><span class="cx">                                 31012E0A18B97B9B0039062F /* ValidateLimitations.cpp */,
</span><span class="lines">@@ -495,6 +536,30 @@
</span><span class="cx">                         name = misc;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><ins>+                5CC7D45919102608000B8C1F /* common */ = {
+                        isa = PBXGroup;
+                        children = (
+                                5CC7D45A19102620000B8C1F /* angleutils.h */,
+                                5CC7D45B19102620000B8C1F /* blocklayout.cpp */,
+                                5CC7D45C19102620000B8C1F /* blocklayout.h */,
+                                5CC7D45D19102620000B8C1F /* debug.cpp */,
+                                5CC7D45E19102620000B8C1F /* debug.h */,
+                                5CC7D45F19102620000B8C1F /* event_tracer.cpp */,
+                                5CC7D46019102620000B8C1F /* event_tracer.h */,
+                                5CC7D46119102620000B8C1F /* mathutil.cpp */,
+                                5CC7D46219102620000B8C1F /* mathutil.h */,
+                                5CC7D46319102620000B8C1F /* RefCountObject.cpp */,
+                                5CC7D46419102620000B8C1F /* RefCountObject.h */,
+                                5CC7D46519102620000B8C1F /* shadervars.cpp */,
+                                5CC7D46619102620000B8C1F /* shadervars.h */,
+                                5CC7D46719102620000B8C1F /* system.h */,
+                                5CC7D46819102620000B8C1F /* utilities.cpp */,
+                                5CC7D46919102620000B8C1F /* utilities.h */,
+                                5CC7D46A19102620000B8C1F /* version.h */,
+                        );
+                        name = common;
+                        sourceTree = "<group>";
+                };
</ins><span class="cx">                 5D7C59C41208C68B001C873E /* Configurations */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -555,6 +620,7 @@
</span><span class="cx">                 FB39D0841200EDEB00088E69 /* src */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                5CC7D45919102608000B8C1F /* common */,
</ins><span class="cx">                                 FB39D2201200F35A00088E69 /* compiler */,
</span><span class="cx">                                 A08C3CD816D6CB35003F0B83 /* third_party */,
</span><span class="cx">                         );
</span><span class="lines">@@ -592,7 +658,6 @@
</span><span class="cx">                                 A264F89A16974DED006FAA5A /* ExpressionParser.h */,
</span><span class="cx">                                 A264F89B16974DED006FAA5A /* Input.cpp */,
</span><span class="cx">                                 A264F89C16974DED006FAA5A /* Input.h */,
</span><del>-                                49951C0214B7AAB30060E96E /* length_limits.h */,
</del><span class="cx">                                 A264F89D16974DED006FAA5A /* Lexer.cpp */,
</span><span class="cx">                                 A264F89E16974DED006FAA5A /* Lexer.h */,
</span><span class="cx">                                 A264F89F16974DED006FAA5A /* Macro.cpp */,
</span><span class="lines">@@ -630,12 +695,16 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 31012E3C18B97B9B0039062F /* InitializeParseContext.h in Headers */,
</span><span class="cx">                                 A08C3CDD16D6CB61003F0B83 /* ArrayBoundsClamper.h in Headers */,
</span><ins>+                                5CC7D46F19102621000B8C1F /* debug.h in Headers */,
+                                5CC7D47519102621000B8C1F /* RefCountObject.h in Headers */,
</ins><span class="cx">                                 31012E3E18B97B9B0039062F /* InitializeVariables.h in Headers */,
</span><span class="cx">                                 31012E1418B97B9B0039062F /* BuiltInFunctionEmulator.h in Headers */,
</span><span class="cx">                                 31012E5518B97B9B0039062F /* ParseContext.h in Headers */,
</span><ins>+                                5CC7D47719102621000B8C1F /* shadervars.h in Headers */,
</ins><span class="cx">                                 31012E2C18B97B9B0039062F /* ForLoopUnroll.h in Headers */,
</span><span class="cx">                                 31012E6D18B97B9B0039062F /* TranslatorGLSL.h in Headers */,
</span><span class="cx">                                 31012E4618B97B9B0039062F /* MMap.h in Headers */,
</span><ins>+                                5CC7D47319102621000B8C1F /* mathutil.h in Headers */,
</ins><span class="cx">                                 31012E6B18B97B9B0039062F /* TranslatorESSL.h in Headers */,
</span><span class="cx">                                 31012E1618B97B9B0039062F /* Common.h in Headers */,
</span><span class="cx">                                 31012E2018B97B9B0039062F /* DependencyGraphOutput.h in Headers */,
</span><span class="lines">@@ -649,32 +718,37 @@
</span><span class="cx">                                 31012E7E18B97B9B0039062F /* VariablePacker.h in Headers */,
</span><span class="cx">                                 31012E5018B97B9B0039062F /* OutputGLSLBase.h in Headers */,
</span><span class="cx">                                 31012E4018B97B9B0039062F /* intermediate.h in Headers */,
</span><ins>+                                5CC7D47119102621000B8C1F /* event_tracer.h in Headers */,
</ins><span class="cx">                                 31012E2518B97B9B0039062F /* DetectDiscontinuity.h in Headers */,
</span><span class="cx">                                 31012E5D18B97B9B0039062F /* RenameFunction.h in Headers */,
</span><span class="cx">                                 31012E3A18B97B9B0039062F /* InitializeGlobals.h in Headers */,
</span><del>-                                31012E4518B97B9B0039062F /* MapLongVariableNames.h in Headers */,
</del><span class="cx">                                 31012E8018B97B9B0039062F /* VersionGLSL.h in Headers */,
</span><ins>+                                5C9FFF4F19102A000025B8FA /* FlagStd140Structs.h in Headers */,
</ins><span class="cx">                                 31012E2718B97B9B0039062F /* Diagnostics.h in Headers */,
</span><ins>+                                5CC7D46B19102620000B8C1F /* angleutils.h in Headers */,
</ins><span class="cx">                                 31012E3218B97B9B0039062F /* glslang_tab.h in Headers */,
</span><span class="cx">                                 A264F8B116974DED006FAA5A /* DirectiveParser.h in Headers */,
</span><span class="cx">                                 31012E5818B97B9B0039062F /* Pragma.h in Headers */,
</span><span class="cx">                                 31012E6518B97B9B0039062F /* SymbolTable.h in Headers */,
</span><ins>+                                5CC7D458191024E4000B8C1F /* ValidateOutputs.h in Headers */,
</ins><span class="cx">                                 31012E7418B97B9B0039062F /* UnfoldShortCircuitAST.h in Headers */,
</span><span class="cx">                                 31012E7218B97B9B0039062F /* UnfoldShortCircuit.h in Headers */,
</span><span class="cx">                                 A264F8B316974DED006FAA5A /* ExpressionParser.h in Headers */,
</span><span class="cx">                                 31012E5C18B97B9B0039062F /* RemoveTree.h in Headers */,
</span><span class="cx">                                 31012E4818B97B9B0039062F /* osinclude.h in Headers */,
</span><span class="cx">                                 31012E3518B97B9B0039062F /* InfoSink.h in Headers */,
</span><ins>+                                5CC7D47819102621000B8C1F /* system.h in Headers */,
</ins><span class="cx">                                 31012E1C18B97B9B0039062F /* DependencyGraph.h in Headers */,
</span><span class="cx">                                 31012E6318B97B9B0039062F /* ShHandle.h in Headers */,
</span><span class="cx">                                 31012E7018B97B9B0039062F /* Types.h in Headers */,
</span><span class="cx">                                 31012E6718B97B9B0039062F /* RestrictFragmentShaderTiming.h in Headers */,
</span><span class="cx">                                 31012E4318B97B9B0039062F /* localintermediate.h in Headers */,
</span><ins>+                                5CC7D47B19102621000B8C1F /* version.h in Headers */,
</ins><span class="cx">                                 31012E7818B97B9B0039062F /* util.h in Headers */,
</span><span class="cx">                                 A264F8B516974DED006FAA5A /* Input.h in Headers */,
</span><ins>+                                5CC7D453191024E4000B8C1F /* LoopInfo.h in Headers */,
</ins><span class="cx">                                 A264F8CD169762AA006FAA5A /* khrplatform.h in Headers */,
</span><del>-                                49951C0314B7AAB30060E96E /* length_limits.h in Headers */,
-                                31012E7618B97B9B0039062F /* Uniform.h in Headers */,
</del><ins>+                                5CC7D47A19102621000B8C1F /* utilities.h in Headers */,
</ins><span class="cx">                                 31012E2318B97B9B0039062F /* DetectCallDepth.h in Headers */,
</span><span class="cx">                                 31012E3918B97B9B0039062F /* InitializeDll.h in Headers */,
</span><span class="cx">                                 A264F8B716974DED006FAA5A /* Lexer.h in Headers */,
</span><span class="lines">@@ -684,6 +758,7 @@
</span><span class="cx">                                 31012E5718B97B9B0039062F /* PoolAlloc.h in Headers */,
</span><span class="cx">                                 31012E3718B97B9B0039062F /* Initialize.h in Headers */,
</span><span class="cx">                                 31012E5218B97B9B0039062F /* OutputHLSL.h in Headers */,
</span><ins>+                                5CC7D46D19102620000B8C1F /* blocklayout.h in Headers */,
</ins><span class="cx">                                 31012E1A18B97B9B0039062F /* ConstantUnion.h in Headers */,
</span><span class="cx">                                 A264F8BB16974DED006FAA5A /* MacroExpander.h in Headers */,
</span><span class="cx">                                 31012E2D18B97B9B0039062F /* glslang.h in Headers */,
</span><span class="lines">@@ -787,14 +862,16 @@
</span><span class="cx">                                 A264F8AC16974DED006FAA5A /* DiagnosticsBase.cpp in Sources */,
</span><span class="cx">                                 31012E1518B97B9B0039062F /* CodeGen.cpp in Sources */,
</span><span class="cx">                                 31012E3F18B97B9B0039062F /* Intermediate.cpp in Sources */,
</span><ins>+                                5CC7D47219102621000B8C1F /* mathutil.cpp in Sources */,
</ins><span class="cx">                                 31012E3B18B97B9B0039062F /* InitializeParseContext.cpp in Sources */,
</span><ins>+                                5CC7D47019102621000B8C1F /* event_tracer.cpp in Sources */,
</ins><span class="cx">                                 31012E3118B97B9B0039062F /* glslang_tab.cpp in Sources */,
</span><span class="cx">                                 31012E2118B97B9B0039062F /* DependencyGraphTraverse.cpp in Sources */,
</span><span class="cx">                                 31012E5E18B97B9B0039062F /* RewriteElseBlocks.cpp in Sources */,
</span><span class="cx">                                 31012E5418B97B9B0039062F /* ParseContext.cpp in Sources */,
</span><span class="cx">                                 A264F8AE16974DED006FAA5A /* DirectiveHandlerBase.cpp in Sources */,
</span><del>-                                31012E7518B97B9B0039062F /* Uniform.cpp in Sources */,
</del><span class="cx">                                 31012E4D18B97B9B0039062F /* OutputGLSL.cpp in Sources */,
</span><ins>+                                5CC7D47619102621000B8C1F /* shadervars.cpp in Sources */,
</ins><span class="cx">                                 31012E3018B97B9B0039062F /* glslang_lex.cpp in Sources */,
</span><span class="cx">                                 31012E4118B97B9B0039062F /* intermOut.cpp in Sources */,
</span><span class="cx">                                 31012E6E18B97B9B0039062F /* TranslatorHLSL.cpp in Sources */,
</span><span class="lines">@@ -807,7 +884,9 @@
</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>+                                5CC7D456191024E4000B8C1F /* Uniform.cpp in Sources */,
</ins><span class="cx">                                 A264F8B416974DED006FAA5A /* Input.cpp in Sources */,
</span><ins>+                                5CC7D47919102621000B8C1F /* utilities.cpp in Sources */,
</ins><span class="cx">                                 A264F8B616974DED006FAA5A /* Lexer.cpp in Sources */,
</span><span class="cx">                                 31012E6218B97B9B0039062F /* ShaderLang.cpp in Sources */,
</span><span class="cx">                                 31012E3818B97B9B0039062F /* InitializeDll.cpp in Sources */,
</span><span class="lines">@@ -820,7 +899,6 @@
</span><span class="cx">                                 31012E1318B97B9B0039062F /* BuiltInFunctionEmulator.cpp in Sources */,
</span><span class="cx">                                 31012E3418B97B9B0039062F /* InfoSink.cpp in Sources */,
</span><span class="cx">                                 31012E5318B97B9B0039062F /* parseConst.cpp in Sources */,
</span><del>-                                31012E4418B97B9B0039062F /* MapLongVariableNames.cpp in Sources */,
</del><span class="cx">                                 31012E5618B97B9B0039062F /* PoolAlloc.cpp in Sources */,
</span><span class="cx">                                 31012E6618B97B9B0039062F /* RestrictFragmentShaderTiming.cpp in Sources */,
</span><span class="cx">                                 31012E7918B97B9B0039062F /* ValidateLimitations.cpp in Sources */,
</span><span class="lines">@@ -828,15 +906,21 @@
</span><span class="cx">                                 31012E7718B97B9B0039062F /* util.cpp in Sources */,
</span><span class="cx">                                 31012E5118B97B9B0039062F /* OutputHLSL.cpp in Sources */,
</span><span class="cx">                                 31012E3618B97B9B0039062F /* Initialize.cpp in Sources */,
</span><ins>+                                5CC7D47419102621000B8C1F /* RefCountObject.cpp in Sources */,
</ins><span class="cx">                                 31012E7B18B97B9B0039062F /* VariableInfo.cpp in Sources */,
</span><ins>+                                5CC7D452191024E4000B8C1F /* LoopInfo.cpp in Sources */,
</ins><span class="cx">                                 31012E1D18B97B9B0039062F /* DependencyGraphBuilder.cpp in Sources */,
</span><span class="cx">                                 31012E7D18B97B9B0039062F /* VariablePacker.cpp in Sources */,
</span><span class="cx">                                 31012E1F18B97B9B0039062F /* DependencyGraphOutput.cpp in Sources */,
</span><ins>+                                5CC7D46C19102620000B8C1F /* blocklayout.cpp in Sources */,
</ins><span class="cx">                                 31012E4B18B97B9B0039062F /* OutputESSL.cpp in Sources */,
</span><span class="cx">                                 A264F8BE16974DED006FAA5A /* Preprocessor.cpp in Sources */,
</span><ins>+                                5CC7D457191024E4000B8C1F /* ValidateOutputs.cpp in Sources */,
</ins><span class="cx">                                 31012E2B18B97B9B0039062F /* ForLoopUnroll.cpp in Sources */,
</span><ins>+                                5C9FFF4E19102A000025B8FA /* FlagStd140Structs.cpp in Sources */,
</ins><span class="cx">                                 31012E2218B97B9B0039062F /* DetectCallDepth.cpp in Sources */,
</span><span class="cx">                                 31012E1718B97B9B0039062F /* Compiler.cpp in Sources */,
</span><ins>+                                5CC7D46E19102621000B8C1F /* debug.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></span></pre></div>
<a id="trunkSourceThirdPartyANGLEAUTHORS"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/AUTHORS (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/AUTHORS        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/AUTHORS        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,6 +13,8 @@
</span><span class="cx">
</span><span class="cx"> Adobe Systems Inc.
</span><span class="cx"> Autodesk, Inc.
</span><ins>+BlackBerry Limited
+Cable Television Laboratories, Inc.
</ins><span class="cx"> Cloud Party, Inc.
</span><span class="cx"> Intel Corporation
</span><span class="cx"> Mozilla Corporation
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLECONTRIBUTORS"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/CONTRIBUTORS (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/CONTRIBUTORS        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/CONTRIBUTORS        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> Adrienne Walker
</span><span class="cx"> thestig@chromium.org
</span><span class="cx"> Justin Schuh
</span><ins>+ Scott Graham
</ins><span class="cx">
</span><span class="cx"> Adobe Systems Inc.
</span><span class="cx"> Alexandru Chiculita
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/ChangeLog        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-04-30 Alex Christensen <achristensen@webkit.org>
+
+ Updated ANGLE.
+ https://bugs.webkit.org/show_bug.cgi?id=132367
+ <rdar://problem/16211451>
+
+ Reviewed by Dean Jackson.
+
+ * ANGLE.plist:
+ Updated and xml encoded.
+ * ANGLE.xcodeproj/project.pbxproj:
+ Added needed new source files.
+ * changes.diff:
+ Added to keep track of differences between WebKit's copy of ANGLE and the master repository.
+
+ Updated ANGLE source files to e7a453a5bd76705ccb151117fa844846d4aa90af. Long list of changes omitted.
+
</ins><span class="cx"> 2014-03-25 Martin Robinson <mrobinson@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Remove the autotools build
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEDEPS"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/DEPS (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/DEPS        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/DEPS        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,18 +1,18 @@
</span><span class="cx"> deps = {
</span><del>- "trunk/third_party/gyp":
- "http://gyp.googlecode.com/svn/trunk@1564",
</del><ins>+ "third_party/gyp":
+ "http://gyp.googlecode.com/svn/trunk@1806",
</ins><span class="cx">
</span><del>- "trunk/third_party/googletest":
- "http://googletest.googlecode.com/svn/trunk@573", #release 1.6.0
</del><ins>+ "tests/third_party/googletest":
+ "http://googletest.googlecode.com/svn/trunk@629",
</ins><span class="cx">
</span><del>- "trunk/third_party/googlemock":
- "http://googlemock.googlecode.com/svn/trunk@387", #release 1.6.0
</del><ins>+ "tests/third_party/googlemock":
+ "http://googlemock.googlecode.com/svn/trunk@410",
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> hooks = [
</span><span class="cx"> {
</span><span class="cx"> # A change to a .gyp, .gypi, or to GYP itself should run the generator.
</span><span class="cx"> "pattern": ".",
</span><del>- "action": ["python", "trunk/build/gyp_angle"],
</del><ins>+ "action": ["python", "build/gyp_angle"],
</ins><span class="cx"> },
</span><span class="cx"> ]
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEchangesdiff"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/changes.diff (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/changes.diff         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/changes.diff        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,227 @@
</span><ins>+diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
+index 7970bfa..9cdcc24 100644
+--- a/include/GLSLANG/ShaderLang.h
++++ b/include/GLSLANG/ShaderLang.h
+@@ -23,7 +23,7 @@
+ #define COMPILER_EXPORT
+ #endif
+
+-#include "KHR/khrplatform.h"
++#include "khrplatform.h"
+ #include <stddef.h>
+
+ //
+diff --git a/src/common/mathutil.h b/src/common/mathutil.h
+index 9061bbd..0b4f384 100644
+--- a/src/common/mathutil.h
++++ b/src/common/mathutil.h
+@@ -478,7 +478,7 @@ inline unsigned int average(unsigned int a, unsigned int b)
+
+ inline signed int average(signed int a, signed int b)
+ {
+- return ((long long)a + (long long)b) / 2;
++ return (signed int)((long long)a + (long long)b) / 2;
+ }
+
+ inline float average(float a, float b)
+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;
+ }
+
+-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
+
+ struct Uniform : public ShaderVariable
+ {
+- unsigned int registerIndex;
+- unsigned int elementIndex; // For struct varyings
++ unsigned long registerIndex;
++ unsigned long elementIndex; // For struct varyings
+ std::vector<Uniform> 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;
+diff --git a/src/compiler/preprocessor/ExpressionParser.cpp b/src/compiler/preprocessor/ExpressionParser.cpp
+index 7c6adc6..fe7a653 100644
+--- a/src/compiler/preprocessor/ExpressionParser.cpp
++++ b/src/compiler/preprocessor/ExpressionParser.cpp
+@@ -1,5 +1,7 @@
+ /* A Bison parser, made by GNU Bison 2.7.1. */
+
++/* 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/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
+index 25aefa9..de8efff 100644
+--- a/src/compiler/preprocessor/Tokenizer.cpp
++++ b/src/compiler/preprocessor/Tokenizer.cpp
+@@ -549,6 +549,12 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
+ #pragma GCC diagnostic ignored "-Wmissing-noreturn"
+ #endif
+
++#if defined(__clang__)
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wunknown-pragmas"
++#pragma clang diagnostic ignored "-Wdeprecated-register"
++#endif
++
+ typedef std::string YYSTYPE;
+ typedef pp::SourceLocation YYLTYPE;
+
+@@ -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
+
++#define YY_NO_INPUT
++
+ #ifndef YY_NO_INPUT
+
+ #ifdef __cplusplus
+@@ -2314,6 +2322,10 @@ void ppfree (void * ptr , yyscan_t yyscanner)
+
+ #define YYTABLES_NAME "yytables"
+
++#if defined(__clang__)
++#pragma clang diagnostic pop
++#endif
++
+ namespace pp {
+
+ 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 "-Wmissing-noreturn"
+ #endif
+
++#if defined(__clang__)
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wunknown-pragmas"
++#pragma clang diagnostic ignored "-Wdeprecated-register"
++#endif
++
+ typedef std::string YYSTYPE;
+ typedef pp::SourceLocation YYLTYPE;
+
+@@ -265,6 +271,10 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
+
+ %%
+
++#if defined(__clang__)
++#pragma clang diagnostic pop
++#endif
++
+ namespace pp {
+
+ Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
+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 "-Wunknown-pragmas"
++#pragma clang diagnostic ignored "-Wdeprecated-register"
++#endif
+ }
+
+ %{
+@@ -379,6 +384,10 @@ O [0-7]
+
+ %%
+
++#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)->preprocessor.lex(&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 "-Wunknown-pragmas"
++#pragma clang diagnostic ignored "-Wdeprecated-register"
++#endif
+
+ #line 25 "./glslang_lex.cpp"
+
+@@ -3181,6 +3184,10 @@ void yyfree (void * ptr , yyscan_t yyscanner)
+
+ #define YYTABLES_NAME "yytables"
+
++#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)->preprocessor.lex(&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. */
+
++/* 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. */
+
++/* 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.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEcodereviewsettings"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/codereview.settings (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/codereview.settings        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/codereview.settings        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> # This file is used by gcl to get repository specific information.
</span><del>-CODE_REVIEW_SERVER: codereview.appspot.com
-CC_LIST: angleproject-review@googlegroups.com
-VIEW_VC: http://code.google.com/p/angleproject/source/detail?r=
</del><ins>+GERRIT_HOST: chromium-review.googlesource.com
+GERRIT_PORT: 29418
+CODE_REVIEW_SERVER: chromium-review.googlesource.com
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeEGLeglh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/EGL/egl.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/EGL/egl.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/include/EGL/egl.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /* -*- mode: c; tab-width: 8; -*- */
</span><span class="cx"> /* vi: set sw=4 ts=8: */
</span><span class="cx"> /* Reference version of egl.h for EGL 1.4.
</span><del>- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
</del><ins>+ * $Revision: 9356 $ on $Date: 2009-10-21 05:52:25 -0400 (Wed, 21 Oct 2009) $
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> /*
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeEGLeglexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*
</span><del>-** Copyright (c) 2007-2012 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">@@ -34,8 +34,8 @@
</span><span class="cx">
</span><span class="cx"> /* Header file version number */
</span><span class="cx"> /* Current version at http://www.khronos.org/registry/egl/ */
</span><del>-/* $Revision: 16473 $ on $Date: 2012-01-04 02:20:48 -0800 (Wed, 04 Jan 2012) $ */
-#define EGL_EGLEXT_VERSION 11
</del><ins>+/* $Revision: 20690 $ on $Date: 2013-02-22 20:15:05 -0500 (Fri, 22 Feb 2013) $ */
+#define EGL_EGLEXT_VERSION 15
</ins><span class="cx">
</span><span class="cx"> #ifndef EGL_KHR_config_attribs
</span><span class="cx"> #define EGL_KHR_config_attribs 1
</span><span class="lines">@@ -208,12 +208,12 @@
</span><span class="cx"> typedef void* EGLSyncNV;
</span><span class="cx"> typedef khronos_utime_nanoseconds_t EGLTimeNV;
</span><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
-EGLBoolean eglFenceNV (EGLSyncNV sync);
-EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
</del><ins>+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 /* EGL_EGLEXT_PROTOTYPES */
</span><span class="cx"> typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
</span><span class="cx"> typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
</span><span class="lines">@@ -250,7 +250,6 @@
</span><span class="cx">         EGLint                iHeight;
</span><span class="cx">         EGLint                iStride;
</span><span class="cx"> };
</span><del>-
</del><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><span class="cx"> EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
</span><span class="cx"> #endif /* EGL_EGLEXT_PROTOTYPES */
</span><span class="lines">@@ -324,12 +323,10 @@
</span><span class="cx"> #define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV        0x3133
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
</del><ins>+#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
</ins><span class="cx"> #ifndef EGL_NV_system_time
</span><span class="cx"> #define EGL_NV_system_time 1
</span><del>-
</del><span class="cx"> typedef khronos_utime_nanoseconds_t EGLuint64NV;
</span><del>-
</del><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><span class="cx"> EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
</span><span class="cx"> EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
</span><span class="lines">@@ -339,6 +336,86 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#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
+
+#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
+
+#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
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#endif
+#endif
+
+#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
+
</ins><span class="cx"> #ifndef EGL_EXT_create_context_robustness
</span><span class="cx"> #define EGL_EXT_create_context_robustness 1
</span><span class="cx"> #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT        0x30BF
</span><span class="lines">@@ -347,8 +424,158 @@
</span><span class="cx"> #define EGL_LOSE_CONTEXT_ON_RESET_EXT                0x31BF
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#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 */
+#endif
+
+#ifndef EGL_ANGLE_window_fixed_size
+#define EGL_ANGLE_window_fixed_size 1
+#define EGL_FIXED_SIZE_ANGLE 0x3201
+#endif
+
+#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
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+/* No tokens/entry points, just relaxes an error condition */
+#endif
+
+#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))
+#ifdef EGL_EGLEXT_PROTOTYPES
+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);
+#endif
+#endif
+
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT                0x3134
+#endif
+
+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+/* No tokens or entry points, just relaxes behavior of SwapBuffers */
+#endif
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+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);
+#endif
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV                        0x3136
+#endif
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID                0x3147
+#endif
+
+#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);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID                0x3140
+#endif
+
+#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
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR);
+#endif
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID                        0x3142
+#endif
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT                        0x313D
+#endif
+
+#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
+
</ins><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#endif
</del><ins>+#endif /* __eglext_h_ */
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeEGLeglplatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h        2014-04-30 22:57:08 UTC (rev 168055)
</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 09:51:28 -0700 (Wed, 25 Aug 2010) $
</del><ins>+ * $Revision: 12306 $ on $Date: 2010-08-25 12:51:28 -0400 (Wed, 25 Aug 2010) $
</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">@@ -83,14 +83,8 @@
</span><span class="cx"> typedef void *EGLNativeWindowType;
</span><span class="cx"> typedef void *EGLNativePixmapType;
</span><span class="cx">
</span><del>-#elif defined(WL_EGL_PLATFORM)
</del><ins>+#elif defined(__unix__)
</ins><span class="cx">
</span><del>-typedef struct wl_display *EGLNativeDisplayType;
-typedef struct wl_egl_pixmap *EGLNativePixmapType;
-typedef struct wl_egl_window *EGLNativeWindowType;
-
-#elif defined(__unix__) && !defined(ANDROID)
-
</del><span class="cx"> /* X11 (tentative) */
</span><span class="cx"> #include <X11/Xlib.h>
</span><span class="cx"> #include <X11/Xutil.h>
</span><span class="lines">@@ -99,14 +93,6 @@
</span><span class="cx"> typedef Pixmap EGLNativePixmapType;
</span><span class="cx"> typedef Window EGLNativeWindowType;
</span><span class="cx">
</span><del>-#elif defined(ANDROID)
-
-struct egl_native_pixmap_t;
-
-typedef struct ANativeWindow* EGLNativeWindowType;
-typedef struct egl_native_pixmap_t* EGLNativePixmapType;
-typedef void* EGLNativeDisplayType;
-
</del><span class="cx"> #else
</span><span class="cx"> #error "Platform not recognized"
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLES2gl2h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> #ifndef __gl2_h_
</span><span class="cx"> #define __gl2_h_
</span><span class="cx">
</span><del>-/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
</del><ins>+/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
</ins><span class="cx">
</span><span class="cx"> #include <GLES2/gl2platform.h>
</span><span class="cx">
</span><span class="lines">@@ -431,7 +431,6 @@
</span><span class="cx"> #define GL_RGB5_A1 0x8057
</span><span class="cx"> #define GL_RGB565 0x8D62
</span><span class="cx"> #define GL_DEPTH_COMPONENT16 0x81A5
</span><del>-#define GL_STENCIL_INDEX 0x1901
</del><span class="cx"> #define GL_STENCIL_INDEX8 0x8D48
</span><span class="cx">
</span><span class="cx"> #define GL_RENDERBUFFER_WIDTH 0x8D42
</span><span class="lines">@@ -528,7 +527,7 @@
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
</span><del>-GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
</del><ins>+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
</ins><span class="cx"> GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
</span><span class="cx"> GL_APICALL GLenum GL_APIENTRY glGetError (void);
</span><span class="lines">@@ -547,7 +546,7 @@
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
</span><del>-GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
</del><ins>+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
</ins><span class="cx"> GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
</span><span class="lines">@@ -569,7 +568,7 @@
</span><span class="cx"> GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
</span><del>-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
</del><ins>+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
</ins><span class="cx"> GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLES2gl2exth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/include/GLES2/gl2ext.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> #ifndef __gl2ext_h_
</span><span class="cx"> #define __gl2ext_h_
</span><span class="cx">
</span><del>-/* $Revision: 16482 $ on $Date:: 2012-01-04 13:44:55 -0500 #$ */
</del><ins>+/* $Revision: 20795 $ on $Date:: 2013-03-07 01:01:58 -0800 #$ */
</ins><span class="cx">
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> extern "C" {
</span><span class="lines">@@ -93,6 +93,25 @@
</span><span class="cx"> #define GL_DEPTH24_STENCIL8_OES 0x88F0
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_OES_required_internalformat */
+#ifndef GL_OES_required_internalformat
+#define GL_ALPHA8_OES 0x803C
+#define GL_DEPTH_COMPONENT16_OES 0x81A5
+/* reuse GL_DEPTH_COMPONENT24_OES */
+/* reuse GL_DEPTH24_STENCIL8_OES */
+/* reuse GL_DEPTH_COMPONENT32_OES */
+#define GL_LUMINANCE4_ALPHA4_OES 0x8043
+#define GL_LUMINANCE8_ALPHA8_OES 0x8045
+#define GL_LUMINANCE8_OES 0x8040
+#define GL_RGBA4_OES 0x8056
+#define GL_RGB5_A1_OES 0x8057
+#define GL_RGB565_OES 0x8D62
+/* reuse GL_RGB8_OES */
+/* reuse GL_RGBA8_OES */
+/* reuse GL_RGB10_EXT */
+/* reuse GL_RGB10_A2_EXT */
+#endif
+
</ins><span class="cx"> /* GL_OES_rgb8_rgba8 */
</span><span class="cx"> #ifndef GL_OES_rgb8_rgba8
</span><span class="cx"> #define GL_RGB8_OES 0x8051
</span><span class="lines">@@ -114,6 +133,10 @@
</span><span class="cx"> #define GL_STENCIL_INDEX4_OES 0x8D47
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#ifndef GL_OES_surfaceless_context
+#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
+#endif
+
</ins><span class="cx"> /* GL_OES_texture_3D */
</span><span class="cx"> #ifndef GL_OES_texture_3D
</span><span class="cx"> #define GL_TEXTURE_WRAP_R_OES 0x8072
</span><span class="lines">@@ -156,6 +179,85 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*------------------------------------------------------------------------*
</span><ins>+ * KHR extension tokens
+ *------------------------------------------------------------------------*/
+
+#ifndef GL_KHR_debug
+typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
+#define GL_DEBUG_SOURCE_API 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION 0x824A
+#define GL_DEBUG_SOURCE_OTHER 0x824B
+#define GL_DEBUG_TYPE_ERROR 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
+#define GL_DEBUG_TYPE_OTHER 0x8251
+#define GL_DEBUG_TYPE_MARKER 0x8268
+#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
+#define GL_DEBUG_TYPE_POP_GROUP 0x826A
+#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
+#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
+#define GL_BUFFER 0x82E0
+#define GL_SHADER 0x82E1
+#define GL_PROGRAM 0x82E2
+#define GL_QUERY 0x82E3
+/* PROGRAM_PIPELINE only in GL */
+#define GL_SAMPLER 0x82E6
+/* DISPLAY_LIST only in GL */
+#define GL_MAX_LABEL_LENGTH 0x82E8
+#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES 0x9145
+#define GL_DEBUG_SEVERITY_HIGH 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
+#define GL_DEBUG_SEVERITY_LOW 0x9148
+#define GL_DEBUG_OUTPUT 0x92E0
+#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#endif
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
+#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
+#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
+#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
+#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
+#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
+#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
+#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
+#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
+#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
+#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
+#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
+#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
+#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+#endif
+
+/*------------------------------------------------------------------------*
</ins><span class="cx"> * AMD extension tokens
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><span class="lines">@@ -192,6 +294,18 @@
</span><span class="cx"> * ANGLE extension tokens
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><ins>+/* GL_ANGLE_depth_texture */
+#ifndef GL_ANGLE_depth_texture
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_UNSIGNED_INT 0x1405
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif
+
</ins><span class="cx"> /* GL_ANGLE_framebuffer_blit */
</span><span class="cx"> #ifndef GL_ANGLE_framebuffer_blit
</span><span class="cx"> #define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
</span><span class="lines">@@ -207,53 +321,49 @@
</span><span class="cx"> #define GL_MAX_SAMPLES_ANGLE 0x8D57
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_ANGLE_instanced_arrays */
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+#endif
+
</ins><span class="cx"> /* GL_ANGLE_pack_reverse_row_order */
</span><del>-#ifndef GL_ANGLE_pack_reverse_row_order
</del><ins>+#ifndef GL_ANGLE_pack_reverse_row_order
</ins><span class="cx"> #define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_ANGLE_program_binary */
+#ifndef GL_ANGLE_program_binary
+#define GL_PROGRAM_BINARY_ANGLE 0x93A6
+#endif
+
</ins><span class="cx"> /* GL_ANGLE_texture_compression_dxt3 */
</span><del>-#ifndef GL_ANGLE_texture_compression_dxt3
</del><ins>+#ifndef GL_ANGLE_texture_compression_dxt3
</ins><span class="cx"> #define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /* GL_ANGLE_texture_compression_dxt5 */
</span><del>-#ifndef GL_ANGLE_texture_compression_dxt5
</del><ins>+#ifndef GL_ANGLE_texture_compression_dxt5
</ins><span class="cx"> #define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-/* GL_ANGLE_translated_shader_source */
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
-#endif
-
</del><span class="cx"> /* GL_ANGLE_texture_usage */
</span><del>-#ifndef GL_ANGLE_texture_usage
</del><ins>+#ifndef GL_ANGLE_texture_usage
</ins><span class="cx"> #define GL_TEXTURE_USAGE_ANGLE 0x93A2
</span><span class="cx"> #define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-/* GL_ANGLE_instanced_arrays */
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
</del><ins>+/* GL_ANGLE_translated_shader_source */
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>-/* GL_ANGLE_program_binary */
-#ifndef GL_ANGLE_program_binary
-#define GL_PROGRAM_BINARY_ANGLE 0x93A6
-#endif
-
</del><span class="cx"> /*------------------------------------------------------------------------*
</span><span class="cx"> * APPLE extension tokens
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><del>-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#endif
-
</del><ins>+/* GL_APPLE_copy_texture_levels */
+/* No new tokens introduced by this extension. */
+
</ins><span class="cx"> /* GL_APPLE_framebuffer_multisample */
</span><span class="cx"> #ifndef GL_APPLE_framebuffer_multisample
</span><span class="cx"> #define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
</span><span class="lines">@@ -265,6 +375,47 @@
</span><span class="cx"> #define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_APPLE_rgb_422 */
+#ifndef GL_APPLE_rgb_422
+#define GL_RGB_422_APPLE 0x8A1F
+#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+#endif
+
+/* GL_APPLE_sync */
+#ifndef GL_APPLE_sync
+
+#ifndef __gl3_h_
+/* These types are defined with reference to <inttypes.h>
+ * in the Apple extension spec, but here we use the Khronos
+ * portable types in khrplatform.h, and assume those types
+ * are always defined.
+ * If any other extensions using these types are defined,
+ * the typedefs must move out of this block and be shared.
+ */
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+#endif
+
+#define GL_SYNC_OBJECT_APPLE 0x8A53
+#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
+#define GL_OBJECT_TYPE_APPLE 0x9112
+#define GL_SYNC_CONDITION_APPLE 0x9113
+#define GL_SYNC_STATUS_APPLE 0x9114
+#define GL_SYNC_FLAGS_APPLE 0x9115
+#define GL_SYNC_FENCE_APPLE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
+#define GL_UNSIGNALED_APPLE 0x9118
+#define GL_SIGNALED_APPLE 0x9119
+#define GL_ALREADY_SIGNALED_APPLE 0x911A
+#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
+#define GL_CONDITION_SATISFIED_APPLE 0x911C
+#define GL_WAIT_FAILED_APPLE 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
+#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
+#endif
+
</ins><span class="cx"> /* GL_APPLE_texture_format_BGRA8888 */
</span><span class="cx"> #ifndef GL_APPLE_texture_format_BGRA8888
</span><span class="cx"> #define GL_BGRA_EXT 0x80E1
</span><span class="lines">@@ -279,6 +430,11 @@
</span><span class="cx"> * ARM extension tokens
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><ins>+/* GL_ARM_mali_program_binary */
+#ifndef GL_ARM_mali_program_binary
+#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
+#endif
+
</ins><span class="cx"> /* GL_ARM_mali_shader_binary */
</span><span class="cx"> #ifndef GL_ARM_mali_shader_binary
</span><span class="cx"> #define GL_MALI_SHADER_BINARY_ARM 0x8F60
</span><span class="lines">@@ -327,14 +483,34 @@
</span><span class="cx"> #define GL_STENCIL_EXT 0x1802
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_EXT_map_buffer_range */
+#ifndef GL_EXT_map_buffer_range
+#define GL_MAP_READ_BIT_EXT 0x0001
+#define GL_MAP_WRITE_BIT_EXT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
+#endif
+
</ins><span class="cx"> /* GL_EXT_multisampled_render_to_texture */
</span><span class="cx"> #ifndef GL_EXT_multisampled_render_to_texture
</span><span class="cx"> #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
</span><del>-#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134
-#define GL_MAX_SAMPLES_EXT 0x9135
</del><ins>+/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
</ins><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_EXT_multiview_draw_buffers */
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_COLOR_ATTACHMENT_EXT 0x90F0
+#define GL_MULTIVIEW_EXT 0x90F1
+#define GL_DRAW_BUFFER_EXT 0x0C01
+#define GL_READ_BUFFER_EXT 0x0C02
+#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
+#endif
+
</ins><span class="cx"> /* GL_EXT_multi_draw_arrays */
</span><span class="cx"> /* No new tokens introduced by this extension. */
</span><span class="cx">
</span><span class="lines">@@ -376,6 +552,11 @@
</span><span class="cx"> #define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_EXT_shader_framebuffer_fetch */
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
+#endif
+
</ins><span class="cx"> /* GL_EXT_shader_texture_lod */
</span><span class="cx"> /* No new tokens introduced by this extension. */
</span><span class="cx">
</span><span class="lines">@@ -384,6 +565,7 @@
</span><span class="cx"> #define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
</span><span class="cx"> #define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
</span><span class="cx"> #define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
</span><ins>+#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /* GL_EXT_sRGB */
</span><span class="lines">@@ -431,13 +613,19 @@
</span><span class="cx"> #define GL_LUMINANCE32F_EXT 0x8818
</span><span class="cx"> #define GL_LUMINANCE_ALPHA32F_EXT 0x8819
</span><span class="cx"> /* reuse GL_RGBA16F_EXT */
</span><del>-#define GL_RGB16F_EXT 0x881B
</del><ins>+/* reuse GL_RGB16F_EXT */
</ins><span class="cx"> #define GL_ALPHA16F_EXT 0x881C
</span><span class="cx"> #define GL_LUMINANCE16F_EXT 0x881E
</span><span class="cx"> #define GL_LUMINANCE_ALPHA16F_EXT 0x881F
</span><span class="cx"> #define GL_RGB10_A2_EXT 0x8059
</span><span class="cx"> #define GL_RGB10_EXT 0x8052
</span><span class="cx"> #define GL_BGRA8_EXT 0x93A1
</span><ins>+#define GL_R8_EXT 0x8229
+#define GL_RG8_EXT 0x822B
+#define GL_R32F_EXT 0x822E
+#define GL_RG32F_EXT 0x8230
+#define GL_R16F_EXT 0x822D
+#define GL_RG16F_EXT 0x822F
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /* GL_EXT_texture_type_2_10_10_10_REV */
</span><span class="lines">@@ -447,9 +635,9 @@
</span><span class="cx">
</span><span class="cx"> /* GL_EXT_unpack_subimage */
</span><span class="cx"> #ifndef GL_EXT_unpack_subimage
</span><del>-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
</del><ins>+#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
+#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*------------------------------------------------------------------------*
</span><span class="lines">@@ -462,6 +650,15 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*------------------------------------------------------------------------*
</span><ins>+ * FJ extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_FJ_shader_binary_GCCSO */
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_GCCSO_SHADER_BINARY_F 0x9260
+#endif
+
+/*------------------------------------------------------------------------*
</ins><span class="cx"> * IMG extension tokens
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><span class="lines">@@ -489,6 +686,12 @@
</span><span class="cx"> #define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_IMG_texture_compression_pvrtc2 */
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
+#endif
+
</ins><span class="cx"> /* GL_IMG_multisampled_render_to_texture */
</span><span class="cx"> #ifndef GL_IMG_multisampled_render_to_texture
</span><span class="cx"> #define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
</span><span class="lines">@@ -594,6 +797,9 @@
</span><span class="cx"> #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_NV_draw_instanced */
+/* No new tokens introduced by this extension. */
+
</ins><span class="cx"> /* GL_NV_fbo_color_attachments */
</span><span class="cx"> #ifndef GL_NV_fbo_color_attachments
</span><span class="cx"> #define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
</span><span class="lines">@@ -607,6 +813,29 @@
</span><span class="cx"> #define GL_FENCE_CONDITION_NV 0x84F4
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_NV_framebuffer_blit */
+#ifndef GL_NV_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_NV 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
+#endif
+
+/* GL_NV_framebuffer_multisample */
+#ifndef GL_NV_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
+#define GL_MAX_SAMPLES_NV 0x8D57
+#endif
+
+/* GL_NV_generate_mipmap_sRGB */
+/* No new tokens introduced by this extension. */
+
+/* GL_NV_instanced_arrays */
+#ifndef GL_NV_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
+#endif
+
</ins><span class="cx"> /* GL_NV_read_buffer */
</span><span class="cx"> #ifndef GL_NV_read_buffer
</span><span class="cx"> #define GL_READ_BUFFER_NV 0x0C02
</span><span class="lines">@@ -624,6 +853,36 @@
</span><span class="cx"> /* GL_NV_read_stencil */
</span><span class="cx"> /* No new tokens introduced by this extension. */
</span><span class="cx">
</span><ins>+/* GL_NV_shadow_samplers_array */
+#ifndef GL_NV_shadow_samplers_array
+#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
+#endif
+
+/* GL_NV_shadow_samplers_cube */
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
+#endif
+
+/* GL_NV_sRGB_formats */
+#ifndef GL_NV_sRGB_formats
+#define GL_SLUMINANCE_NV 0x8C46
+#define GL_SLUMINANCE_ALPHA_NV 0x8C44
+#define GL_SRGB8_NV 0x8C41
+#define GL_SLUMINANCE8_NV 0x8C47
+#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
+#define GL_ETC1_SRGB8_NV 0x88EE
+#endif
+
+/* GL_NV_texture_border_clamp */
+#ifndef GL_NV_texture_border_clamp
+#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
+#define GL_CLAMP_TO_BORDER_NV 0x812D
+#endif
+
</ins><span class="cx"> /* GL_NV_texture_compression_s3tc_update */
</span><span class="cx"> /* No new tokens introduced by this extension. */
</span><span class="cx">
</span><span class="lines">@@ -641,6 +900,14 @@
</span><span class="cx"> #define GL_ALPHA_TEST_REF_QCOM 0x0BC2
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_QCOM_binning_control */
+#ifndef GL_QCOM_binning_control
+#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
+#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
+#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
+#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
+#endif
+
</ins><span class="cx"> /* GL_QCOM_driver_control */
</span><span class="cx"> /* No new tokens introduced by this extension. */
</span><span class="cx">
</span><span class="lines">@@ -811,6 +1078,11 @@
</span><span class="cx"> #define GL_OES_packed_depth_stencil 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_OES_required_internalformat */
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#endif
+
</ins><span class="cx"> /* GL_OES_rgb8_rgba8 */
</span><span class="cx"> #ifndef GL_OES_rgb8_rgba8
</span><span class="cx"> #define GL_OES_rgb8_rgba8 1
</span><span class="lines">@@ -831,6 +1103,10 @@
</span><span class="cx"> #define GL_OES_stencil4 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#ifndef GL_OES_surfaceless_context
+#define GL_OES_surfaceless_context 1
+#endif
+
</ins><span class="cx"> /* GL_OES_texture_3D */
</span><span class="cx"> #ifndef GL_OES_texture_3D
</span><span class="cx"> #define GL_OES_texture_3D 1
</span><span class="lines">@@ -901,6 +1177,43 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*------------------------------------------------------------------------*
</span><ins>+ * KHR extension functions
+ *------------------------------------------------------------------------*/
+
+#ifndef GL_KHR_debug
+#define GL_KHR_debug 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GL_APICALL void GL_APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GL_APICALL void GL_APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);
+GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GL_APICALL void GL_APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GL_APICALL void GL_APIENTRY glPopDebugGroup (void);
+GL_APICALL void GL_APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
+#endif
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
+typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
+typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params);
+#endif
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_KHR_texture_compression_astc_ldr 1
+#endif
+
+
+/*------------------------------------------------------------------------*
</ins><span class="cx"> * AMD extension functions
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><span class="lines">@@ -952,6 +1265,11 @@
</span><span class="cx"> * ANGLE extension functions
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><ins>+/* GL_ANGLE_depth_texture */
+#ifndef GL_ANGLE_depth_texture
+#define GL_ANGLE_depth_texture 1
+#endif
+
</ins><span class="cx"> /* GL_ANGLE_framebuffer_blit */
</span><span class="cx"> #ifndef GL_ANGLE_framebuffer_blit
</span><span class="cx"> #define GL_ANGLE_framebuffer_blit 1
</span><span class="lines">@@ -970,56 +1288,63 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#ifndef GL_ANGLE_instanced_arrays
+#define GL_ANGLE_instanced_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
+#endif
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
+#endif
+
</ins><span class="cx"> /* GL_ANGLE_pack_reverse_row_order */
</span><del>-#ifndef GL_ANGLE_pack_reverse_row_order
</del><ins>+#ifndef GL_ANGLE_pack_reverse_row_order
</ins><span class="cx"> #define GL_ANGLE_pack_reverse_row_order 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_ANGLE_program_binary */
+#ifndef GL_ANGLE_program_binary
+#define GL_ANGLE_program_binary 1
+#endif
+
</ins><span class="cx"> /* GL_ANGLE_texture_compression_dxt3 */
</span><del>-#ifndef GL_ANGLE_texture_compression_dxt3
</del><ins>+#ifndef GL_ANGLE_texture_compression_dxt3
</ins><span class="cx"> #define GL_ANGLE_texture_compression_dxt3 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /* GL_ANGLE_texture_compression_dxt5 */
</span><del>-#ifndef GL_ANGLE_texture_compression_dxt5
</del><ins>+#ifndef GL_ANGLE_texture_compression_dxt5
</ins><span class="cx"> #define GL_ANGLE_texture_compression_dxt5 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-/* GL_ANGLE_translated_shader_source */
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_ANGLE_translated_shader_source 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-#endif
-
</del><span class="cx"> /* GL_ANGLE_texture_usage */
</span><del>-#ifndef GL_ANGLE_texture_usage
</del><ins>+#ifndef GL_ANGLE_texture_usage
</ins><span class="cx"> #define GL_ANGLE_texture_usage 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-/* GL_ANGLE_instanced_arrays */
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_ANGLE_instanced_arrays 1
</del><ins>+#ifndef GL_ANGLE_translated_shader_source
+#define GL_ANGLE_translated_shader_source 1
</ins><span class="cx"> #ifdef GL_GLEXT_PROTOTYPES
</span><del>-GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor);
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
</del><ins>+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
</ins><span class="cx"> #endif
</span><del>-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
</del><ins>+typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*------------------------------------------------------------------------*
</span><span class="cx"> * APPLE extension functions
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><del>-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
</del><ins>+/* GL_APPLE_copy_texture_levels */
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
</ins><span class="cx"> #endif
</span><ins>+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
</ins><span class="cx">
</span><span class="cx"> /* GL_APPLE_framebuffer_multisample */
</span><span class="cx"> #ifndef GL_APPLE_framebuffer_multisample
</span><span class="lines">@@ -1032,6 +1357,32 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_APPLE_rgb_422 */
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#endif
+
+/* GL_APPLE_sync */
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+
</ins><span class="cx"> /* GL_APPLE_texture_format_BGRA8888 */
</span><span class="cx"> #ifndef GL_APPLE_texture_format_BGRA8888
</span><span class="cx"> #define GL_APPLE_texture_format_BGRA8888 1
</span><span class="lines">@@ -1046,6 +1397,11 @@
</span><span class="cx"> * ARM extension functions
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><ins>+/* GL_ARM_mali_program_binary */
+#ifndef GL_ARM_mali_program_binary
+#define GL_ARM_mali_program_binary 1
+#endif
+
</ins><span class="cx"> /* GL_ARM_mali_shader_binary */
</span><span class="cx"> #ifndef GL_ARM_mali_shader_binary
</span><span class="cx"> #define GL_ARM_mali_shader_binary 1
</span><span class="lines">@@ -1103,6 +1459,17 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_EXT_map_buffer_range */
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+
</ins><span class="cx"> /* GL_EXT_multisampled_render_to_texture */
</span><span class="cx"> #ifndef GL_EXT_multisampled_render_to_texture
</span><span class="cx"> #define GL_EXT_multisampled_render_to_texture 1
</span><span class="lines">@@ -1114,10 +1481,23 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_EXT_multiview_draw_buffers */
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_EXT_multiview_draw_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
+GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
+#endif
+typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
+#endif
+
</ins><span class="cx"> #ifndef GL_EXT_multi_draw_arrays
</span><span class="cx"> #define GL_EXT_multi_draw_arrays 1
</span><span class="cx"> #ifdef GL_GLEXT_PROTOTYPES
</span><del>-GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
</del><ins>+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei);
</ins><span class="cx"> GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
</span><span class="cx"> #endif /* GL_GLEXT_PROTOTYPES */
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
</span><span class="lines">@@ -1232,6 +1612,11 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_EXT_shader_framebuffer_fetch */
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_EXT_shader_framebuffer_fetch 1
+#endif
+
</ins><span class="cx"> /* GL_EXT_shader_texture_lod */
</span><span class="cx"> #ifndef GL_EXT_shader_texture_lod
</span><span class="cx"> #define GL_EXT_shader_texture_lod 1
</span><span class="lines">@@ -1306,6 +1691,15 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*------------------------------------------------------------------------*
</span><ins>+ * FJ extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_FJ_shader_binary_GCCSO */
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_FJ_shader_binary_GCCSO 1
+#endif
+
+/*------------------------------------------------------------------------*
</ins><span class="cx"> * IMG extension functions
</span><span class="cx"> *------------------------------------------------------------------------*/
</span><span class="cx">
</span><span class="lines">@@ -1329,6 +1723,11 @@
</span><span class="cx"> #define GL_IMG_texture_compression_pvrtc 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_IMG_texture_compression_pvrtc2 */
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_IMG_texture_compression_pvrtc2 1
+#endif
+
</ins><span class="cx"> /* GL_IMG_multisampled_render_to_texture */
</span><span class="cx"> #ifndef GL_IMG_multisampled_render_to_texture
</span><span class="cx"> #define GL_IMG_multisampled_render_to_texture 1
</span><span class="lines">@@ -1336,8 +1735,8 @@
</span><span class="cx"> GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
</span><span class="cx"> GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
</span><span class="cx"> #endif
</span><del>-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
</del><ins>+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /*------------------------------------------------------------------------*
</span><span class="lines">@@ -1369,6 +1768,7 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_EXT_draw_buffers */
</ins><span class="cx"> #ifndef GL_EXT_draw_buffers
</span><span class="cx"> #define GL_EXT_draw_buffers 1
</span><span class="cx"> #ifdef GL_GLEXT_PROTOTYPES
</span><span class="lines">@@ -1377,6 +1777,17 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_NV_draw_instanced */
+#ifndef GL_NV_draw_instanced
+#define GL_NV_draw_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+typedef void (GL_APIENTRYP PFNDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+
</ins><span class="cx"> /* GL_NV_fbo_color_attachments */
</span><span class="cx"> #ifndef GL_NV_fbo_color_attachments
</span><span class="cx"> #define GL_NV_fbo_color_attachments 1
</span><span class="lines">@@ -1403,6 +1814,38 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_NV_framebuffer_blit */
+#ifndef GL_NV_framebuffer_blit
+#define GL_NV_framebuffer_blit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferNV (int srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+typedef void (GL_APIENTRYP PFNBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+
+/* GL_NV_framebuffer_multisample */
+#ifndef GL_NV_framebuffer_multisample
+#define GL_NV_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+typedef void (GL_APIENTRYP PFNRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+
+/* GL_NV_generate_mipmap_sRGB */
+#ifndef GL_NV_generate_mipmap_sRGB
+#define GL_NV_generate_mipmap_sRGB 1
+#endif
+
+/* GL_NV_instanced_arrays */
+#ifndef GL_NV_instanced_arrays
+#define GL_NV_instanced_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
+#endif
+typedef void (GL_APIENTRYP PFNVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
+#endif
+
</ins><span class="cx"> /* GL_NV_read_buffer */
</span><span class="cx"> #ifndef GL_NV_read_buffer
</span><span class="cx"> #define GL_NV_read_buffer 1
</span><span class="lines">@@ -1432,6 +1875,26 @@
</span><span class="cx"> #define GL_NV_read_stencil 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_NV_shadow_samplers_array */
+#ifndef GL_NV_shadow_samplers_array
+#define GL_NV_shadow_samplers_array 1
+#endif
+
+/* GL_NV_shadow_samplers_cube */
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_NV_shadow_samplers_cube 1
+#endif
+
+/* GL_NV_sRGB_formats */
+#ifndef GL_NV_sRGB_formats
+#define GL_NV_sRGB_formats 1
+#endif
+
+/* GL_NV_texture_border_clamp */
+#ifndef GL_NV_texture_border_clamp
+#define GL_NV_texture_border_clamp 1
+#endif
+
</ins><span class="cx"> /* GL_NV_texture_compression_s3tc_update */
</span><span class="cx"> #ifndef GL_NV_texture_compression_s3tc_update
</span><span class="cx"> #define GL_NV_texture_compression_s3tc_update 1
</span><span class="lines">@@ -1455,6 +1918,11 @@
</span><span class="cx"> typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+/* GL_QCOM_binning_control */
+#ifndef GL_QCOM_binning_control
+#define GL_QCOM_binning_control 1
+#endif
+
</ins><span class="cx"> /* GL_QCOM_driver_control */
</span><span class="cx"> #ifndef GL_QCOM_driver_control
</span><span class="cx"> #define GL_QCOM_driver_control 1
</span><span class="lines">@@ -1538,11 +2006,6 @@
</span><span class="cx"> #define GL_VIV_shader_binary 1
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-/* GL_ANGLE_program_binary */
-#ifndef GL_ANGLE_program_binary
-#define GL_ANGLE_program_binary 1
-#endif
-
</del><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLES3gl3h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,1061 @@
</span><ins>+#ifndef __gl3_h_
+#define __gl3_h_
+
+/*
+ * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $
+ */
+
+#include <GLES3/gl3platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2013 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", 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.
+*/
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 2.0 */
+
+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 khronos_int32_t GLfixed;
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
+
+/* OpenGL ES 3.0 */
+
+typedef unsigned short GLhalf;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+/*-------------------------------------------------------------------------
+ * Token definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_3_0 1
+#define GL_ES_VERSION_2_0 1
+
+/* OpenGL ES 2.0 */
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#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_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+/* GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+/* GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+#define GL_TEXTURE 0x1702
+
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#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_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_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_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX8 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+
+#define GL_NONE 0
+
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+
+/* OpenGL ES 3.0 */
+
+#define GL_READ_BUFFER 0x0C02
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_RED 0x1903
+#define GL_RGB8 0x8051
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_CURRENT_QUERY 0x8865
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_STREAM_READ 0x88E1
+#define GL_STREAM_COPY 0x88E2
+#define GL_STATIC_READ 0x88E5
+#define GL_STATIC_COPY 0x88E6
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#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_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_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#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_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_RGBA32F 0x8814
+#define GL_RGB32F 0x8815
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_RGB9_E5 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI 0x8D70
+#define GL_RGB32UI 0x8D71
+#define GL_RGBA16UI 0x8D76
+#define GL_RGB16UI 0x8D77
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGB8UI 0x8D7D
+#define GL_RGBA32I 0x8D82
+#define GL_RGB32I 0x8D83
+#define GL_RGBA16I 0x8D88
+#define GL_RGB16I 0x8D89
+#define GL_RGBA8I 0x8D8E
+#define GL_RGB8I 0x8D8F
+#define GL_RED_INTEGER 0x8D94
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#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_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_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_HALF_FLOAT 0x140B
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_RG8 0x822B
+#define GL_R16F 0x822D
+#define GL_R32F 0x822E
+#define GL_RG16F 0x822F
+#define GL_RG32F 0x8230
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_COPY_READ_BUFFER_BINDING GL_COPY_READ_BUFFER
+#define GL_COPY_WRITE_BUFFER_BINDING GL_COPY_WRITE_BUFFER
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_RGB10_A2UI 0x906F
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#define GL_COMPRESSED_R11_EAC 0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
+#define GL_COMPRESSED_RG11_EAC 0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
+#define GL_COMPRESSED_RGB8_ETC2 0x9274
+#define GL_COMPRESSED_SRGB8_ETC2 0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+
+/*-------------------------------------------------------------------------
+ * Entrypoint definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 2.0 */
+
+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);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat depth);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+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);
+
+/* OpenGL ES 3.0 */
+
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL 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);
+GL_APICALL 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);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL 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);
+GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint* ids);
+GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint* ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint* params);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid** params);
+GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum* bufs);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL GLvoid* GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint* arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint* arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint* data);
+GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
+GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint* params);
+GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint* v);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint* v);
+GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint* params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint* value);
+GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint* value);
+GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte* GL_APIENTRY glGetStringi (GLenum name, GLuint index);
+GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar* uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64* params);
+GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64* data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64* params);
+GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint* samplers);
+GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint* samplers);
+GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
+GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint* param);
+GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat* param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint* ids);
+GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint* ids);
+GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
+GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments);
+GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLES3gl3exth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3ext.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3ext.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3ext.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+#ifndef __gl3ext_h_
+#define __gl3ext_h_
+
+/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* OpenGL ES 3 Extensions
+ *
+ * After an OES extension's interactions with OpenGl ES 3.0 have been documented,
+ * its tokens and function definitions should be added to this file in a manner
+ * that does not conflict with gl2ext.h or gl3.h.
+ *
+ * Tokens and function definitions for extensions that have become standard
+ * features in OpenGL ES 3.0 will not be added to this file.
+ *
+ * Applications using OpenGL-ES-2-only extensions should include gl2ext.h
+ */
+
+#endif /* __gl3ext_h_ */
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLES3gl3platformh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3platform.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3platform.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/GLES3/gl3platform.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+#ifndef __gl3platform_h_
+#define __gl3platform_h_
+
+/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl3platform_h_ */
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLSLANGShaderLangh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // Version number for shader translation API.
</span><del>-// It is incremented everytime the API changes.
-#define ANGLE_SH_VERSION 112
</del><ins>+// It is incremented every time the API changes.
+#define ANGLE_SH_VERSION 123
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // The names of the following enums have been derived by replacing GL prefix
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx"> typedef enum {
</span><span class="cx"> SH_NONE = 0,
</span><span class="cx"> SH_INT = 0x1404,
</span><ins>+ SH_UNSIGNED_INT = 0x1405,
</ins><span class="cx"> SH_FLOAT = 0x1406,
</span><span class="cx"> SH_FLOAT_VEC2 = 0x8B50,
</span><span class="cx"> SH_FLOAT_VEC3 = 0x8B51,
</span><span class="lines">@@ -95,6 +96,9 @@
</span><span class="cx"> SH_INT_VEC2 = 0x8B53,
</span><span class="cx"> SH_INT_VEC3 = 0x8B54,
</span><span class="cx"> SH_INT_VEC4 = 0x8B55,
</span><ins>+ SH_UNSIGNED_INT_VEC2 = 0x8DC6,
+ SH_UNSIGNED_INT_VEC3 = 0x8DC7,
+ SH_UNSIGNED_INT_VEC4 = 0x8DC8,
</ins><span class="cx"> SH_BOOL = 0x8B56,
</span><span class="cx"> SH_BOOL_VEC2 = 0x8B57,
</span><span class="cx"> SH_BOOL_VEC3 = 0x8B58,
</span><span class="lines">@@ -102,10 +106,29 @@
</span><span class="cx"> SH_FLOAT_MAT2 = 0x8B5A,
</span><span class="cx"> SH_FLOAT_MAT3 = 0x8B5B,
</span><span class="cx"> SH_FLOAT_MAT4 = 0x8B5C,
</span><ins>+ SH_FLOAT_MAT2x3 = 0x8B65,
+ SH_FLOAT_MAT2x4 = 0x8B66,
+ SH_FLOAT_MAT3x2 = 0x8B67,
+ SH_FLOAT_MAT3x4 = 0x8B68,
+ SH_FLOAT_MAT4x2 = 0x8B69,
+ SH_FLOAT_MAT4x3 = 0x8B6A,
</ins><span class="cx"> SH_SAMPLER_2D = 0x8B5E,
</span><ins>+ SH_SAMPLER_3D = 0x8B5F,
</ins><span class="cx"> SH_SAMPLER_CUBE = 0x8B60,
</span><span class="cx"> SH_SAMPLER_2D_RECT_ARB = 0x8B63,
</span><del>- SH_SAMPLER_EXTERNAL_OES = 0x8D66
</del><ins>+ 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
</ins><span class="cx"> } ShDataType;
</span><span class="cx">
</span><span class="cx"> typedef enum {
</span><span class="lines">@@ -116,19 +139,24 @@
</span><span class="cx"> } ShPrecisionType;
</span><span class="cx">
</span><span class="cx"> typedef enum {
</span><del>- 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
</del><ins>+ 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,
</ins><span class="cx"> } ShShaderInfo;
</span><span class="cx">
</span><span class="cx"> // Compile options.
</span><span class="lines">@@ -140,13 +168,17 @@
</span><span class="cx"> SH_VARIABLES = 0x0008,
</span><span class="cx"> SH_LINE_DIRECTIVES = 0x0010,
</span><span class="cx"> SH_SOURCE_PATH = 0x0020,
</span><del>- SH_MAP_LONG_VARIABLE_NAMES = 0x0040,
- SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0080,
</del><ins>+ SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0040,
+ // If a sampler array index happens to be a loop index,
+ // 1) if its type is integer, unroll the loop.
+ // 2) if its type is float, fail the shader compile.
+ // This is to work around a mac driver bug.
+ SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0080,
</ins><span class="cx">
</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">@@ -252,11 +284,18 @@
</span><span class="cx"> int ARB_texture_rectangle;
</span><span class="cx"> int EXT_draw_buffers;
</span><span class="cx"> int EXT_frag_depth;
</span><ins>+ int EXT_shader_texture_lod;
</ins><span class="cx">
</span><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="cx">
</span><ins>+ // GLSL ES 3.0 constants.
+ int MaxVertexOutputVectors;
+ int MaxFragmentInputVectors;
+ int MinProgramTexelOffset;
+ int MaxProgramTexelOffset;
+
</ins><span class="cx"> // Name Hashing.
</span><span class="cx"> // Set a 64 bit hash function to enable user-defined name hashing.
</span><span class="cx"> // Default is NULL.
</span><span class="lines">@@ -280,7 +319,7 @@
</span><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. It's 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="lines">@@ -364,6 +403,7 @@
</span><span class="cx"> // SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
</span><span class="cx"> // null termination character.
</span><span class="cx"> // SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
</span><ins>+// SH_SHADER_VERSION: the version of the shader language
</ins><span class="cx"> //
</span><span class="cx"> // params: Requested parameter
</span><span class="cx"> COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcbuild_anglegyp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/build_angle.gyp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/build_angle.gyp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/build_angle.gyp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -3,13 +3,8 @@
</span><span class="cx"> # found in the LICENSE file.
</span><span class="cx">
</span><span class="cx"> {
</span><del>- 'includes': [
- 'build_angle.gypi',
- ],
</del><ins>+ 'includes':
+ [
+ 'angle.gypi',
+ ],
</ins><span class="cx"> }
</span><del>-
-# Local Variables:
-# tab-width:2
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=2 shiftwidth=2:
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonRefCountObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -15,6 +15,7 @@
</span><span class="cx"> #include <cstddef>
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><span class="lines">@@ -47,7 +48,7 @@
</span><span class="cx">
</span><span class="cx"> public:
</span><span class="cx"> GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; }
</span><del>- bool operator ! () const { return (get() == NULL); }
</del><ins>+ bool operator!() const { return (get() == NULL); }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> RefCountObject *mObject;
</span><span class="lines">@@ -59,7 +60,65 @@
</span><span class="cx"> public:
</span><span class="cx"> void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
</span><span class="cx"> ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
</span><del>- ObjectType *operator -> () const { return get(); }
</del><ins>+ ObjectType *operator->() const { return get(); }
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+template <class ObjectType>
+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<ObjectType*>(RefCountObjectBindingPointer::get()); }
+ ObjectType *operator->() 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 <class ObjectType>
+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<ObjectType*>(RefCountObjectBindingPointer::get()); }
+ ObjectType *operator->() const { return get(); }
+
+ private:
+ GLintptr mOffset;
+ GLsizeiptr mSize;
+};
+
</ins><span class="cx"> #endif // COMMON_REFCOUNTOBJECT_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonangleutilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -56,6 +56,28 @@
</span><span class="cx"> resource = NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// Provide a less-than function for comparing structs
+// Note: struct memory must be initialized to zero, because of packing gaps
+template <typename T>
+inline bool StructLessThan(const T &a, const T &b)
+{
+ return (memcmp(&a, &b, sizeof(T)) < 0);
+}
+
+// Provide a less-than function for comparing structs
+// Note: struct memory must be initialized to zero, because of packing gaps
+template <typename T>
+inline bool StructEquals(const T &a, const T &b)
+{
+ return (memcmp(&a, &b, sizeof(T)) == 0);
+}
+
+template <typename T>
+inline void StructZero(T *obj)
+{
+ memset(obj, 0, sizeof(T));
+}
+
</ins><span class="cx"> #if defined(_MSC_VER)
</span><span class="cx"> #define snprintf _snprintf
</span><span class="cx"> #endif
</span><span class="lines">@@ -66,5 +88,7 @@
</span><span class="cx">
</span><span class="cx"> #define GL_BGRA4_ANGLEX 0x6ABC
</span><span class="cx"> #define GL_BGR5_A1_ANGLEX 0x6ABD
</span><ins>+#define GL_INT_64_ANGLEX 0x6ABE
+#define GL_STRUCT_ANGLEX 0x6ABF
</ins><span class="cx">
</span><span class="cx"> #endif // COMMON_ANGLEUTILS_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonblocklayoutcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,305 @@
</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 "common/blocklayout.h"
+#include "common/shadervars.h"
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+namespace gl
+{
+
+BlockLayoutEncoder::BlockLayoutEncoder(std::vector<BlockMemberInfo> *blockInfoOut)
+ : mCurrentOffset(0),
+ mBlockInfoOut(blockInfoOut)
+{
+}
+
+void BlockLayoutEncoder::encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields)
+{
+ for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ const InterfaceBlockField &variable = fields[fieldIndex];
+
+ if (variable.fields.size() > 0)
+ {
+ const unsigned int elementCount = std::max(1u, variable.arraySize);
+
+ for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ enterAggregateType();
+ encodeInterfaceBlockFields(variable.fields);
+ exitAggregateType();
+ }
+ }
+ else
+ {
+ encodeInterfaceBlockField(variable);
+ }
+ }
+}
+
+void BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &field)
+{
+ int arrayStride;
+ int matrixStride;
+
+ ASSERT(field.fields.empty());
+ getBlockLayoutInfo(field.type, field.arraySize, field.isRowMajorMatrix, &arrayStride, &matrixStride);
+
+ const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, field.isRowMajorMatrix);
+
+ if (mBlockInfoOut)
+ {
+ mBlockInfoOut->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, &arrayStride, &matrixStride);
+
+ const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
+
+ if (mBlockInfoOut)
+ {
+ mBlockInfoOut->push_back(memberInfo);
+ }
+
+ advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);
+}
+
+void BlockLayoutEncoder::nextRegister()
+{
+ mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);
+}
+
+Std140BlockEncoder::Std140BlockEncoder(std::vector<BlockMemberInfo> *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 > 0)
+ {
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ arrayStride = ComponentsPerRegister * numRegisters;
+ }
+ }
+ else if (arraySize > 0)
+ {
+ baseAlignment = ComponentsPerRegister;
+ arrayStride = ComponentsPerRegister;
+ }
+ else
+ {
+ const int numComponents = gl::UniformComponentCount(type);
+ baseAlignment = (numComponents == 3 ? 4u : static_cast<size_t>(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 > 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<BlockMemberInfo> *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 > 0)
+ {
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ arrayStride = ComponentsPerRegister * numRegisters;
+ }
+ }
+ else if (arraySize > 0)
+ {
+ nextRegister();
+ arrayStride = ComponentsPerRegister;
+ }
+ else
+ {
+ int numComponents = gl::UniformComponentCount(type);
+ if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) > ComponentsPerRegister)
+ {
+ nextRegister();
+ }
+ }
+
+ *matrixStrideOut = matrixStride;
+ *arrayStrideOut = arrayStride;
+}
+
+void HLSLBlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
+{
+ if (arraySize > 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<gl::BlockMemberInfo> &blockInfo)
+{
+ // because this method computes offsets (element indexes) instead of any total sizes,
+ // we can ignore the array size of the variable
+
+ if (variable->isStruct())
+ {
+ encoder->enterAggregateType();
+
+ for (size_t fieldIndex = 0; fieldIndex < variable->fields.size(); fieldIndex++)
+ {
+ HLSLVariableGetRegisterInfo(baseRegisterIndex, &variable->fields[fieldIndex], encoder, blockInfo);
+ }
+
+ encoder->exitAggregateType();
+ }
+ else
+ {
+ encoder->encodeType(variable->type, variable->arraySize, false);
+
+ const size_t registerBytes = (encoder->BytesPerComponent * encoder->ComponentsPerRegister);
+ variable->registerIndex = baseRegisterIndex + (blockInfo.back().offset / registerBytes);
+ variable->elementIndex = (blockInfo.back().offset % registerBytes) / sizeof(float);
+ }
+}
+
+void HLSLVariableGetRegisterInfo(unsigned int baseRegisterIndex, gl::Uniform *variable)
+{
+ std::vector<BlockMemberInfo> blockInfo;
+ HLSLBlockEncoder encoder(&blockInfo);
+ HLSLVariableGetRegisterInfo(baseRegisterIndex, variable, &encoder, blockInfo);
+}
+
+template <class ShaderVarType>
+void HLSLVariableRegisterCount(const ShaderVarType &variable, HLSLBlockEncoder *encoder)
+{
+ if (variable.isStruct())
+ {
+ for (size_t arrayElement = 0; arrayElement < variable.elementCount(); arrayElement++)
+ {
+ encoder->enterAggregateType();
+
+ for (size_t fieldIndex = 0; fieldIndex < variable.fields.size(); fieldIndex++)
+ {
+ HLSLVariableRegisterCount(variable.fields[fieldIndex], encoder);
+ }
+
+ encoder->exitAggregateType();
+ }
+ }
+ else
+ {
+ // We operate only on varyings and uniforms, which do not have matrix layout qualifiers
+ encoder->encodeType(variable.type, variable.arraySize, false);
+ }
+}
+
+unsigned int HLSLVariableRegisterCount(const Varying &variable)
+{
+ HLSLBlockEncoder encoder(NULL);
+ HLSLVariableRegisterCount(variable, &encoder);
+
+ const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
+ return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
+}
+
+unsigned int HLSLVariableRegisterCount(const Uniform &variable)
+{
+ HLSLBlockEncoder encoder(NULL);
+ HLSLVariableRegisterCount(variable, &encoder);
+
+ const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
+ return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonblocklayouth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.h        2014-04-30 22:57:08 UTC (rev 168055)
</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.
+//
+// blocklayout.h:
+// Methods and classes related to uniform layout and packing in GLSL and HLSL.
+//
+
+#ifndef COMMON_BLOCKLAYOUT_H_
+#define COMMON_BLOCKLAYOUT_H_
+
+#include <vector>
+#define GL_APICALL
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+#include <cstddef>
+
+namespace gl
+{
+
+struct ShaderVariable;
+struct InterfaceBlockField;
+struct BlockMemberInfo;
+struct Uniform;
+struct Varying;
+
+class BlockLayoutEncoder
+{
+ public:
+ BlockLayoutEncoder(std::vector<BlockMemberInfo> *blockInfoOut);
+
+ void encodeInterfaceBlockFields(const std::vector<InterfaceBlockField> &fields);
+ void encodeInterfaceBlockField(const InterfaceBlockField &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<BlockMemberInfo> *mBlockInfoOut;
+};
+
+// Block layout according to the std140 block layout
+// See "Standard Uniform Block Layout" in Section 2.11.6 of the OpenGL ES 3.0 specification
+
+class Std140BlockEncoder : public BlockLayoutEncoder
+{
+ public:
+ Std140BlockEncoder(std::vector<BlockMemberInfo> *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<BlockMemberInfo> *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 "registerIndex" and "elementIndex" fields.
+// "elementIndex" 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 &variable);
+unsigned int HLSLVariableRegisterCount(const Uniform &variable);
+
+}
+
+#endif // COMMON_BLOCKLAYOUT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommondebugcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -8,6 +8,9 @@
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><span class="cx"> #include <stdarg.h>
</span><ins>+#include <vector>
+#include <fstream>
+#include <cstdio>
</ins><span class="cx">
</span><span class="cx"> #if defined(ANGLE_ENABLE_PERF)
</span><span class="cx"> #include <d3d9.h>
</span><span class="lines">@@ -23,25 +26,38 @@
</span><span class="cx">
</span><span class="cx"> static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
</span><span class="cx"> {
</span><ins>+#if defined(ANGLE_ENABLE_PERF) || defined(ANGLE_ENABLE_TRACE)
+ static std::vector<char> asciiMessageBuffer(512);
+
+ // Attempt to just print to the current buffer
+ int len = vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
+ if (len < 0 || static_cast<size_t>(len) >= asciiMessageBuffer.size())
+ {
+ // Buffer was not large enough, calculate the required size and resize the buffer
+ len = vsnprintf(NULL, 0, format, vararg);
+ asciiMessageBuffer.resize(len + 1);
+
+ // Print again
+ vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
+ }
+
+ // NULL terminate the buffer to be safe
+ asciiMessageBuffer[len] = '\0';
+#endif
+
</ins><span class="cx"> #if defined(ANGLE_ENABLE_PERF)
</span><span class="cx"> if (perfActive())
</span><span class="cx"> {
</span><del>- char message[32768];
- int len = vsprintf_s(message, format, vararg);
- if (len < 0)
</del><ins>+ // The perf function only accepts wide strings, widen the ascii message
+ static std::wstring wideMessage;
+ if (wideMessage.capacity() < asciiMessageBuffer.size())
</ins><span class="cx"> {
</span><del>- return;
</del><ins>+ wideMessage.reserve(asciiMessageBuffer.size());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- // There are no ASCII variants of these D3DPERF functions.
- wchar_t wideMessage[32768];
- for (int i = 0; i < len; ++i)
- {
- wideMessage[i] = message[i];
- }
- wideMessage[len] = 0;
</del><ins>+ wideMessage.assign(asciiMessageBuffer.begin(), asciiMessageBuffer.begin() + len);
</ins><span class="cx">
</span><del>- perfFunc(0, wideMessage);
</del><ins>+ perfFunc(0, wideMessage.c_str());
</ins><span class="cx"> }
</span><span class="cx"> #endif // ANGLE_ENABLE_PERF
</span><span class="cx">
</span><span class="lines">@@ -53,12 +69,13 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // NDEBUG
</span><span class="cx">
</span><del>- FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
</del><ins>+ static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
</ins><span class="cx"> if (file)
</span><span class="cx"> {
</span><del>- vfprintf(file, format, vararg);
- fclose(file);
</del><ins>+ file.write(&asciiMessageBuffer[0], len);
+ file.flush();
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // ANGLE_ENABLE_TRACE
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommondebugh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/debug.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/debug.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/common/debug.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -82,10 +82,17 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // A macro to indicate unimplemented functionality
</span><ins>+
+// Define NOASSERT_UNIMPLEMENTED to non zero to skip the assert fail in the unimplemented checks
+// This will allow us to test with some automated test suites (eg dEQP) without crashing
+#ifndef NOASSERT_UNIMPLEMENTED
+#define NOASSERT_UNIMPLEMENTED 0
+#endif
+
</ins><span class="cx"> #if !defined(NDEBUG)
</span><span class="cx"> #define UNIMPLEMENTED() do { \
</span><span class="cx"> FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
</span><del>- assert(false); \
</del><ins>+ assert(NOASSERT_UNIMPLEMENTED); \
</ins><span class="cx"> } while(0)
</span><span class="cx"> #else
</span><span class="cx"> #define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
</span><span class="lines">@@ -101,9 +108,7 @@
</span><span class="cx"> #define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __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. MSVC uses _CPPRTTI.
-// GCC uses __GXX_RTTI, but the macro was introduced in version 4.3, so we assume that all older
-// versions support RTTI.
</del><ins>+// A macro that determines whether an object has a given runtime type.
</ins><span class="cx"> #if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI))
</span><span class="cx"> #define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
</span><span class="cx"> #else
</span><span class="lines">@@ -111,6 +116,13 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // A macro functioning as a compile-time assert to validate constant conditions
</span><del>-#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition)?1:-1]
</del><ins>+#if defined(_MSC_VER) && _MSC_VER >= 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<bool>(condition)?1:-1]
+#endif
+#define META_ASSERT(condition) META_ASSERT_MSG(condition, "compile time assertion failed.")
</ins><span class="cx">
</span><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 (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> extern "C" {
</span><span class="cx">
</span><span class="cx"> void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
</span><del>- AddTraceEventFunc addTraceEvent)
</del><ins>+ AddTraceEventFunc addTraceEvent)
</ins><span class="cx"> {
</span><span class="cx"> gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
</span><span class="cx"> gl::g_addTraceEvent = addTraceEvent;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonmathutilcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,66 @@
</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.
+//
+
+// mathutil.cpp: Math and bit manipulation functions.
+
+#include "common/mathutil.h"
+#include <algorithm>
+#include <math.h>
+
+namespace gl
+{
+
+struct RGB9E5Data
+{
+ unsigned int R : 9;
+ unsigned int G : 9;
+ unsigned int B : 9;
+ unsigned int E : 5;
+};
+
+// B is the exponent bias (15)
+static const int g_sharedexp_bias = 15;
+
+// N is the number of mantissa bits per component (9)
+static const int g_sharedexp_mantissabits = 9;
+
+// Emax is the maximum allowed biased exponent value (31)
+static const int g_sharedexp_maxexponent = 31;
+
+static const float g_sharedexp_max = ((pow(2.0f, g_sharedexp_mantissabits) - 1) /
+ pow(2.0f, g_sharedexp_mantissabits)) *
+ pow(2.0f, g_sharedexp_maxexponent - g_sharedexp_bias);
+
+unsigned int convertRGBFloatsTo999E5(float red, float green, float blue)
+{
+ const float red_c = std::max<float>(0, std::min(g_sharedexp_max, red));
+ const float green_c = std::max<float>(0, std::min(g_sharedexp_max, green));
+ const float blue_c = std::max<float>(0, std::min(g_sharedexp_max, blue));
+
+ const float max_c = std::max<float>(std::max<float>(red_c, green_c), blue_c);
+ const float exp_p = std::max<float>(-g_sharedexp_bias - 1, floor(log(max_c))) + 1 + g_sharedexp_bias;
+ 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 < pow(2.0f, g_sharedexp_mantissabits)) ? exp_p : exp_p + 1;
+
+ RGB9E5Data output;
+ 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);
+ output.E = exp_s;
+
+ return *reinterpret_cast<unsigned int*>(&output);
+}
+
+void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue)
+{
+ const RGB9E5Data *inputData = reinterpret_cast<const RGB9E5Data*>(&input);
+
+ *red = inputData->R * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
+ *green = inputData->G * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
+ *blue = inputData->B * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonmathutilh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/mathutil.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/mathutil.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/mathutil.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,540 @@
</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.
+//
+
+// mathutil.h: Math and bit manipulation functions.
+
+#ifndef LIBGLESV2_MATHUTIL_H_
+#define LIBGLESV2_MATHUTIL_H_
+
+#include "common/debug.h"
+
+#if defined(_WIN32)
+#include <intrin.h>
+#endif
+
+#include <limits>
+#include <algorithm>
+#include <string.h>
+
+namespace gl
+{
+
+const unsigned int Float32One = 0x3F800000;
+const unsigned short Float16One = 0x3C00;
+
+struct Vector4
+{
+ Vector4() {}
+ Vector4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {}
+
+ float x;
+ float y;
+ float z;
+ float w;
+};
+
+inline bool isPow2(int x)
+{
+ return (x & (x - 1)) == 0 && (x != 0);
+}
+
+inline int log2(int x)
+{
+ int r = 0;
+ while ((x >> r) > 1) r++;
+ return r;
+}
+
+inline unsigned int ceilPow2(unsigned int x)
+{
+ if (x != 0) x--;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ x++;
+
+ return x;
+}
+
+inline int clampToInt(unsigned int x)
+{
+ return static_cast<int>(std::min(x, static_cast<unsigned int>(std::numeric_limits<int>::max())));
+}
+
+template <typename DestT, typename SrcT>
+inline DestT clampCast(SrcT value)
+{
+ // This assumes SrcT can properly represent DestT::min/max
+ // Unfortunately we can't use META_ASSERT without C++11 constexpr support
+ ASSERT(static_cast<DestT>(static_cast<SrcT>(std::numeric_limits<DestT>::min())) == std::numeric_limits<DestT>::min());
+ ASSERT(static_cast<DestT>(static_cast<SrcT>(std::numeric_limits<DestT>::max())) == std::numeric_limits<DestT>::max());
+
+ SrcT lo = static_cast<SrcT>(std::numeric_limits<DestT>::min());
+ SrcT hi = static_cast<SrcT>(std::numeric_limits<DestT>::max());
+ return static_cast<DestT>(value > lo ? (value > hi ? hi : value) : lo);
+}
+
+template<typename T, typename MIN, typename MAX>
+inline T clamp(T x, MIN min, MAX max)
+{
+ // Since NaNs fail all comparison tests, a NaN value will default to min
+ return x > min ? (x > max ? max : x) : min;
+}
+
+inline float clamp01(float x)
+{
+ return clamp(x, 0.0f, 1.0f);
+}
+
+template<const int n>
+inline unsigned int unorm(float x)
+{
+ const unsigned int max = 0xFFFFFFFF >> (32 - n);
+
+ if (x > 1)
+ {
+ return max;
+ }
+ else if (x < 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return (unsigned int)(max * x + 0.5f);
+ }
+}
+
+inline bool supportsSSE2()
+{
+#if defined(_WIN32)
+ static bool checked = false;
+ static bool supports = false;
+
+ if (checked)
+ {
+ return supports;
+ }
+
+ int info[4];
+ __cpuid(info, 0);
+
+ if (info[0] >= 1)
+ {
+ __cpuid(info, 1);
+
+ supports = (info[3] >> 26) & 1;
+ }
+
+ checked = true;
+
+ return supports;
+#else
+ UNIMPLEMENTED();
+ return false;
+#endif
+}
+
+template <typename destType, typename sourceType>
+destType bitCast(const sourceType &source)
+{
+ size_t copySize = std::min(sizeof(destType), sizeof(sourceType));
+ destType output;
+ memcpy(&output, &source, copySize);
+ return output;
+}
+
+inline unsigned short float32ToFloat16(float fp32)
+{
+ unsigned int fp32i = (unsigned int&)fp32;
+ unsigned int sign = (fp32i & 0x80000000) >> 16;
+ unsigned int abs = fp32i & 0x7FFFFFFF;
+
+ if(abs > 0x47FFEFFF) // Infinity
+ {
+ return sign | 0x7FFF;
+ }
+ else if(abs < 0x38800000) // Denormal
+ {
+ unsigned int mantissa = (abs & 0x007FFFFF) | 0x00800000;
+ int e = 113 - (abs >> 23);
+
+ if(e < 24)
+ {
+ abs = mantissa >> e;
+ }
+ else
+ {
+ abs = 0;
+ }
+
+ return sign | (abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
+ }
+ else
+ {
+ return sign | (abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
+ }
+}
+
+float float16ToFloat32(unsigned short h);
+
+unsigned int convertRGBFloatsTo999E5(float red, float green, float blue);
+void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float *blue);
+
+inline unsigned short float32ToFloat11(float fp32)
+{
+ const unsigned int float32MantissaMask = 0x7FFFFF;
+ const unsigned int float32ExponentMask = 0x7F800000;
+ const unsigned int float32SignMask = 0x80000000;
+ const unsigned int float32ValueMask = ~float32SignMask;
+ const unsigned int float32ExponentFirstBit = 23;
+ const unsigned int float32ExponentBias = 127;
+
+ const unsigned short float11Max = 0x7BF;
+ const unsigned short float11MantissaMask = 0x3F;
+ const unsigned short float11ExponentMask = 0x7C0;
+ const unsigned short float11BitMask = 0x7FF;
+ const unsigned int float11ExponentBias = 14;
+
+ const unsigned int float32Maxfloat11 = 0x477E0000;
+ const unsigned int float32Minfloat11 = 0x38800000;
+
+ const unsigned int float32Bits = bitCast<unsigned int>(fp32);
+ const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
+
+ unsigned int float32Val = float32Bits & float32ValueMask;
+
+ if ((float32Val & float32ExponentMask) == float32ExponentMask)
+ {
+ // INF or NAN
+ if ((float32Val & float32MantissaMask) != 0)
+ {
+ return float11ExponentMask | (((float32Val >> 17) | (float32Val >> 11) | (float32Val >> 6) | (float32Val)) & float11MantissaMask);
+ }
+ else if (float32Sign)
+ {
+ // -INF is clamped to 0 since float11 is positive only
+ return 0;
+ }
+ else
+ {
+ return float11ExponentMask;
+ }
+ }
+ else if (float32Sign)
+ {
+ // float11 is positive only, so clamp to zero
+ return 0;
+ }
+ else if (float32Val > float32Maxfloat11)
+ {
+ // The number is too large to be represented as a float11, set to max
+ return float11Max;
+ }
+ else
+ {
+ if (float32Val < float32Minfloat11)
+ {
+ // The number is too small to be represented as a normalized float11
+ // Convert it to a denormalized value.
+ const unsigned int shift = (float32ExponentBias - float11ExponentBias) - (float32Val >> float32ExponentFirstBit);
+ float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift;
+ }
+ else
+ {
+ // Rebias the exponent to represent the value as a normalized float11
+ float32Val += 0xC8000000;
+ }
+
+ return ((float32Val + 0xFFFF + ((float32Val >> 17) & 1)) >> 17) & float11BitMask;
+ }
+}
+
+inline unsigned short float32ToFloat10(float fp32)
+{
+ const unsigned int float32MantissaMask = 0x7FFFFF;
+ const unsigned int float32ExponentMask = 0x7F800000;
+ const unsigned int float32SignMask = 0x80000000;
+ const unsigned int float32ValueMask = ~float32SignMask;
+ const unsigned int float32ExponentFirstBit = 23;
+ const unsigned int float32ExponentBias = 127;
+
+ const unsigned short float10Max = 0x3DF;
+ const unsigned short float10MantissaMask = 0x1F;
+ const unsigned short float10ExponentMask = 0x3E0;
+ const unsigned short float10BitMask = 0x3FF;
+ const unsigned int float10ExponentBias = 14;
+
+ const unsigned int float32Maxfloat10 = 0x477C0000;
+ const unsigned int float32Minfloat10 = 0x38800000;
+
+ const unsigned int float32Bits = bitCast<unsigned int>(fp32);
+ const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
+
+ unsigned int float32Val = float32Bits & float32ValueMask;
+
+ if ((float32Val & float32ExponentMask) == float32ExponentMask)
+ {
+ // INF or NAN
+ if ((float32Val & float32MantissaMask) != 0)
+ {
+ return float10ExponentMask | (((float32Val >> 18) | (float32Val >> 13) | (float32Val >> 3) | (float32Val)) & float10MantissaMask);
+ }
+ else if (float32Sign)
+ {
+ // -INF is clamped to 0 since float11 is positive only
+ return 0;
+ }
+ else
+ {
+ return float10ExponentMask;
+ }
+ }
+ else if (float32Sign)
+ {
+ // float10 is positive only, so clamp to zero
+ return 0;
+ }
+ else if (float32Val > float32Maxfloat10)
+ {
+ // The number is too large to be represented as a float11, set to max
+ return float10Max;
+ }
+ else
+ {
+ if (float32Val < float32Minfloat10)
+ {
+ // The number is too small to be represented as a normalized float11
+ // Convert it to a denormalized value.
+ const unsigned int shift = (float32ExponentBias - float10ExponentBias) - (float32Val >> float32ExponentFirstBit);
+ float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift;
+ }
+ else
+ {
+ // Rebias the exponent to represent the value as a normalized float11
+ float32Val += 0xC8000000;
+ }
+
+ return ((float32Val + 0x1FFFF + ((float32Val >> 18) & 1)) >> 18) & float10BitMask;
+ }
+}
+
+inline float float11ToFloat32(unsigned short fp11)
+{
+ unsigned short exponent = (fp11 >> 6) & 0x1F;
+ unsigned short mantissa = fp11 & 0x3F;
+
+ if (exponent == 0x1F)
+ {
+ // INF or NAN
+ return bitCast<float>(0x7f800000 | (mantissa << 17));
+ }
+ else
+ {
+ if (exponent != 0)
+ {
+ // normalized
+ }
+ else if (mantissa != 0)
+ {
+ // The value is denormalized
+ exponent = 1;
+
+ do
+ {
+ exponent--;
+ mantissa <<= 1;
+ }
+ while ((mantissa & 0x40) == 0);
+
+ mantissa = mantissa & 0x3F;
+ }
+ else // The value is zero
+ {
+ exponent = -112;
+ }
+
+ return bitCast<float>(((exponent + 112) << 23) | (mantissa << 17));
+ }
+}
+
+inline float float10ToFloat32(unsigned short fp11)
+{
+ unsigned short exponent = (fp11 >> 5) & 0x1F;
+ unsigned short mantissa = fp11 & 0x1F;
+
+ if (exponent == 0x1F)
+ {
+ // INF or NAN
+ return bitCast<float>(0x7f800000 | (mantissa << 17));
+ }
+ else
+ {
+ if (exponent != 0)
+ {
+ // normalized
+ }
+ else if (mantissa != 0)
+ {
+ // The value is denormalized
+ exponent = 1;
+
+ do
+ {
+ exponent--;
+ mantissa <<= 1;
+ }
+ while ((mantissa & 0x20) == 0);
+
+ mantissa = mantissa & 0x1F;
+ }
+ else // The value is zero
+ {
+ exponent = -112;
+ }
+
+ return bitCast<float>(((exponent + 112) << 23) | (mantissa << 18));
+ }
+}
+
+template <typename T>
+inline float normalizedToFloat(T input)
+{
+ META_ASSERT(std::numeric_limits<T>::is_integer);
+
+ const float inverseMax = 1.0f / std::numeric_limits<T>::max();
+ return input * inverseMax;
+}
+
+template <unsigned int inputBitCount, typename T>
+inline float normalizedToFloat(T input)
+{
+ META_ASSERT(std::numeric_limits<T>::is_integer);
+ META_ASSERT(inputBitCount < (sizeof(T) * 8));
+
+ const float inverseMax = 1.0f / ((1 << inputBitCount) - 1);
+ return input * inverseMax;
+}
+
+template <typename T>
+inline T floatToNormalized(float input)
+{
+ return std::numeric_limits<T>::max() * input + 0.5f;
+}
+
+template <unsigned int outputBitCount, typename T>
+inline T floatToNormalized(float input)
+{
+ META_ASSERT(outputBitCount < (sizeof(T) * 8));
+ return ((1 << outputBitCount) - 1) * input + 0.5f;
+}
+
+template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
+inline T getShiftedData(T input)
+{
+ META_ASSERT(inputBitCount + inputBitStart <= (sizeof(T) * 8));
+ const T mask = (1 << inputBitCount) - 1;
+ return (input >> inputBitStart) & mask;
+}
+
+template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
+inline T shiftData(T input)
+{
+ META_ASSERT(inputBitCount + inputBitStart <= (sizeof(T) * 8));
+ const T mask = (1 << inputBitCount) - 1;
+ return (input & mask) << inputBitStart;
+}
+
+
+inline unsigned char average(unsigned char a, unsigned char b)
+{
+ return ((a ^ b) >> 1) + (a & b);
+}
+
+inline signed char average(signed char a, signed char b)
+{
+ return ((short)a + (short)b) / 2;
+}
+
+inline unsigned short average(unsigned short a, unsigned short b)
+{
+ return ((a ^ b) >> 1) + (a & b);
+}
+
+inline signed short average(signed short a, signed short b)
+{
+ return ((int)a + (int)b) / 2;
+}
+
+inline unsigned int average(unsigned int a, unsigned int b)
+{
+ return ((a ^ b) >> 1) + (a & b);
+}
+
+inline signed int average(signed int a, signed int b)
+{
+ return (signed int)((long long)a + (long long)b) / 2;
+}
+
+inline float average(float a, float b)
+{
+ return (a + b) * 0.5f;
+}
+
+inline unsigned short averageHalfFloat(unsigned short a, unsigned short b)
+{
+ return float32ToFloat16((float16ToFloat32(a) + float16ToFloat32(b)) * 0.5f);
+}
+
+inline unsigned int averageFloat11(unsigned int a, unsigned int b)
+{
+ return float32ToFloat11((float11ToFloat32(a) + float11ToFloat32(b)) * 0.5f);
+}
+
+inline unsigned int averageFloat10(unsigned int a, unsigned int b)
+{
+ return float32ToFloat10((float10ToFloat32(a) + float10ToFloat32(b)) * 0.5f);
+}
+
+}
+
+namespace rx
+{
+
+struct Range
+{
+ Range() {}
+ Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo <= hi); }
+
+ int start;
+ int end;
+};
+
+template <typename T>
+T roundUp(const T value, const T alignment)
+{
+ return value + alignment - 1 - (value - 1) % alignment;
+}
+
+template <class T>
+inline bool IsUnsignedAdditionSafe(T lhs, T rhs)
+{
+ META_ASSERT(!std::numeric_limits<T>::is_signed);
+ return (rhs <= std::numeric_limits<T>::max() - lhs);
+}
+
+template <class T>
+inline bool IsUnsignedMultiplicationSafe(T lhs, T rhs)
+{
+ META_ASSERT(!std::numeric_limits<T>::is_signed);
+ return (lhs == T(0) || rhs == T(0) || (rhs <= std::numeric_limits<T>::max() / lhs));
+}
+
+}
+
+#endif // LIBGLESV2_MATHUTIL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonshadervarscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/shadervars.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/shadervars.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/shadervars.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,81 @@
</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.cpp:
+// Implementation for GL shader variable member functions.
+//
+
+#include "common/shadervars.h"
+
+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, "", 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)
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonshadervarsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/shadervars.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/shadervars.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/shadervars.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,127 @@
</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 COMMON_SHADERVARIABLE_H_
+#define COMMON_SHADERVARIABLE_H_
+
+#include <string>
+#include <vector>
+#include <algorithm>
+
+#define GL_APICALL
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+
+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 > 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<Uniform> 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<InterfaceBlockField> 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<Varying> 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<BlockMemberInfo> 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<InterfaceBlockField> fields;
+ std::vector<BlockMemberInfo> blockInfo;
+
+ unsigned int registerIndex;
+};
+
+}
+
+#endif // COMMON_SHADERVARIABLE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonutilitiescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/utilities.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/utilities.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/utilities.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,473 @@
</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.
+//
+
+// utilities.cpp: Conversion functions and other utility routines.
+
+#include "common/utilities.h"
+#include "common/mathutil.h"
+
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
+#include <set>
+
+namespace gl
+{
+
+int UniformComponentCount(GLenum type)
+{
+ 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;
+}
+
+GLenum UniformComponentType(GLenum type)
+{
+ switch(type)
+ {
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ return GL_BOOL;
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x3:
+ return 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_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ return GL_INT;
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC4:
+ return GL_UNSIGNED_INT;
+ default:
+ UNREACHABLE();
+ }
+
+ return GL_NONE;
+}
+
+size_t UniformComponentSize(GLenum type)
+{
+ switch(type)
+ {
+ case GL_BOOL: return sizeof(GLint);
+ case GL_FLOAT: return sizeof(GLfloat);
+ case GL_INT: return sizeof(GLint);
+ case GL_UNSIGNED_INT: return sizeof(GLuint);
+ default: UNREACHABLE();
+ }
+
+ return 0;
+}
+
+size_t UniformInternalSize(GLenum type)
+{
+ // Expanded to 4-element vectors
+ return UniformComponentSize(UniformComponentType(type)) * VariableRowCount(type) * 4;
+}
+
+size_t UniformExternalSize(GLenum type)
+{
+ return UniformComponentSize(UniformComponentType(type)) * UniformComponentCount(type);
+}
+
+GLenum UniformBoolVectorType(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ return GL_BOOL;
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ return GL_BOOL_VEC2;
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ return GL_BOOL_VEC3;
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ return GL_BOOL_VEC4;
+
+ default:
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+int VariableRowCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_NONE:
+ case GL_STRUCT_ANGLEX:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ 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:
+ return 1;
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT4x2:
+ return 2;
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT4x3:
+ return 3;
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+int VariableColumnCount(GLenum type)
+{
+ switch (type)
+ {
+ case GL_NONE:
+ case GL_STRUCT_ANGLEX:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_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:
+ return 1;
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT2x4:
+ return 2;
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT3x4:
+ return 3;
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+
+ return 0;
+}
+
+bool IsSampler(GLenum type)
+{
+ switch (type)
+ {
+ 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:
+ return true;
+ }
+
+ return false;
+}
+
+bool IsMatrixType(GLenum type)
+{
+ return VariableRowCount(type) > 1;
+}
+
+GLenum TransposeMatrixType(GLenum type)
+{
+ if (!IsMatrixType(type))
+ {
+ return type;
+ }
+
+ switch (type)
+ {
+ case GL_FLOAT_MAT2: return GL_FLOAT_MAT2;
+ case GL_FLOAT_MAT3: return GL_FLOAT_MAT3;
+ case GL_FLOAT_MAT4: return GL_FLOAT_MAT4;
+ case GL_FLOAT_MAT2x3: return GL_FLOAT_MAT3x2;
+ case GL_FLOAT_MAT3x2: return GL_FLOAT_MAT2x3;
+ case GL_FLOAT_MAT2x4: return GL_FLOAT_MAT4x2;
+ case GL_FLOAT_MAT4x2: return GL_FLOAT_MAT2x4;
+ case GL_FLOAT_MAT3x4: return GL_FLOAT_MAT4x3;
+ case GL_FLOAT_MAT4x3: return GL_FLOAT_MAT3x4;
+ default: UNREACHABLE(); return GL_NONE;
+ }
+}
+
+int MatrixRegisterCount(GLenum type, bool isRowMajorMatrix)
+{
+ ASSERT(IsMatrixType(type));
+ return isRowMajorMatrix ? VariableRowCount(type) : VariableColumnCount(type);
+}
+
+int MatrixComponentCount(GLenum type, bool isRowMajorMatrix)
+{
+ ASSERT(IsMatrixType(type));
+ return isRowMajorMatrix ? VariableColumnCount(type) : VariableRowCount(type);
+}
+
+int AttributeRegisterCount(GLenum type)
+{
+ return IsMatrixType(type) ? VariableColumnCount(type) : 1;
+}
+
+int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)
+{
+ ASSERT(allocationSize <= bitsSize);
+
+ unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
+
+ for (unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
+ {
+ if ((*bits & mask) == 0)
+ {
+ *bits |= mask;
+ return i;
+ }
+
+ mask <<= 1;
+ }
+
+ return -1;
+}
+
+bool IsCubemapTextureTarget(GLenum target)
+{
+ return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
+}
+
+bool IsInternalTextureTarget(GLenum target, GLuint clientVersion)
+{
+ 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;
+ }
+}
+
+bool IsTriangleMode(GLenum drawMode)
+{
+ switch (drawMode)
+ {
+ case GL_TRIANGLES:
+ case GL_TRIANGLE_FAN:
+ case GL_TRIANGLE_STRIP:
+ return true;
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_LINE_LOOP:
+ case GL_LINE_STRIP:
+ return false;
+ default: UNREACHABLE();
+ }
+
+ return false;
+}
+
+}
+
+std::string getTempPath()
+{
+#if defined (_WIN32)
+ char path[MAX_PATH];
+ DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
+ if (pathLen == 0)
+ {
+ UNREACHABLE();
+ return std::string();
+ }
+
+ UINT unique = GetTempFileNameA(path, "sh", 0, path);
+ if (unique == 0)
+ {
+ UNREACHABLE();
+ return std::string();
+ }
+
+ return path;
+#else
+ UNIMPLEMENTED();
+ return "";
+#endif
+}
+
+void writeFile(const char* path, const void* content, size_t size)
+{
+ FILE* file = fopen(path, "w");
+ if (!file)
+ {
+ UNREACHABLE();
+ return;
+ }
+
+ fwrite(content, sizeof(char), size, file);
+ fclose(file);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonutilitiesh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/utilities.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/utilities.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/utilities.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,59 @@
</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.
+//
+
+// utilities.h: Conversion functions and other utility routines.
+
+#ifndef LIBGLESV2_UTILITIES_H
+#define LIBGLESV2_UTILITIES_H
+
+#ifndef GL_APICALL
+#define GL_APICALL
+#endif
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <string>
+#include <math.h>
+
+namespace gl
+{
+
+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);
+int VariableRowCount(GLenum type);
+int VariableColumnCount(GLenum type);
+bool IsSampler(GLenum type);
+bool IsMatrixType(GLenum type);
+GLenum TransposeMatrixType(GLenum type);
+int AttributeRegisterCount(GLenum type);
+int MatrixRegisterCount(GLenum type, bool isRowMajorMatrix);
+int MatrixComponentCount(GLenum type, bool isRowMajorMatrix);
+
+int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
+
+bool IsCubemapTextureTarget(GLenum target);
+bool IsInternalTextureTarget(GLenum target, GLuint clientVersion);
+
+bool IsTriangleMode(GLenum drawMode);
+
+// [OpenGL ES 3.0.2] Section 2.3.1 page 14
+// Data Conversion For State-Setting Commands
+// Floating-point values are rounded to the nearest integer, instead of truncated, as done by static_cast.
+template <typename outT> outT iround(GLfloat value) { return static_cast<outT>(value > 0.0f ? floor(value + 0.5f) : ceil(value - 0.5f)); }
+template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(value + 0.5f); }
+
+}
+
+std::string getTempPath();
+void writeFile(const char* path, const void* data, size_t size);
+
+#endif // LIBGLESV2_UTILITIES_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2011-2013 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">@@ -708,7 +708,9 @@
</span><span class="cx">
</span><span class="cx"> enum State
</span><span class="cx"> {
</span><del>- VERSION_NUMBER
</del><ins>+ VERSION_NUMBER,
+ VERSION_PROFILE,
+ VERSION_ENDLINE
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> bool valid = true;
</span><span class="lines">@@ -716,12 +718,12 @@
</span><span class="cx"> int state = VERSION_NUMBER;
</span><span class="cx">
</span><span class="cx"> mTokenizer->lex(token);
</span><del>- while ((token->type != '\n') && (token->type != Token::LAST))
</del><ins>+ while (valid && (token->type != '\n') && (token->type != Token::LAST))
</ins><span class="cx"> {
</span><del>- switch (state++)
</del><ins>+ switch (state)
</ins><span class="cx"> {
</span><span class="cx"> case VERSION_NUMBER:
</span><del>- if (valid && (token->type != Token::CONST_INT))
</del><ins>+ if (token->type != Token::CONST_INT)
</ins><span class="cx"> {
</span><span class="cx"> mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
</span><span class="cx"> token->location, token->text);
</span><span class="lines">@@ -733,26 +735,41 @@
</span><span class="cx"> token->location, token->text);
</span><span class="cx"> valid = false;
</span><span class="cx"> }
</span><del>- break;
- default:
</del><span class="cx"> if (valid)
</span><span class="cx"> {
</span><del>- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
</del><ins>+ state = (version < 300) ? VERSION_ENDLINE : VERSION_PROFILE;
+ }
+ break;
+ case VERSION_PROFILE:
+ if (token->type != Token::IDENTIFIER || token->text != "es")
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
</ins><span class="cx"> token->location, token->text);
</span><span class="cx"> valid = false;
</span><span class="cx"> }
</span><ins>+ state = VERSION_ENDLINE;
</ins><span class="cx"> break;
</span><ins>+ default:
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
+ token->location, token->text);
+ valid = false;
+ break;
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> mTokenizer->lex(token);
</span><span class="cx"> }
</span><del>- if (valid && (state != VERSION_NUMBER + 1))
</del><ins>+
+ if (valid && (state != VERSION_ENDLINE))
</ins><span class="cx"> {
</span><span class="cx"> mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
</span><span class="cx"> token->location, token->text);
</span><span class="cx"> valid = false;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> if (valid)
</span><ins>+ {
</ins><span class="cx"> mDirectiveHandler->handleVersion(token->location, version);
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DirectiveParser::parseLine(Token* token)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,10 +1,10 @@
</span><del>-/* A Bison parser, made by GNU Bison 2.7. */
</del><ins>+/* A Bison parser, made by GNU Bison 2.7.1. */
</ins><span class="cx">
</span><span class="cx"> /* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */
</span><span class="cx">
</span><span class="cx"> /* Bison implementation for Yacc-like parsers in C
</span><span class="cx">
</span><del>- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
</del><ins>+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
</ins><span class="cx">
</span><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="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 "2.7"
</del><ins>+#define YYBISON_VERSION "2.7.1"
</ins><span class="cx">
</span><span class="cx"> /* Skeleton name. */
</span><span class="cx"> #define YYSKELETON_NAME "yacc.c"
</span><span class="lines">@@ -266,6 +266,14 @@
</span><span class="cx"> # endif
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if (! defined __GNUC__ || __GNUC__ < 2 \
+ || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
+# define __attribute__(Spec) /* empty */
+# endif
+#endif
+
</ins><span class="cx"> /* Suppress unused-variable warnings by "using" E. */
</span><span class="cx"> #if ! defined lint || defined __GNUC__
</span><span class="cx"> # define YYUSE(E) ((void) (E))
</span><span class="lines">@@ -273,6 +281,7 @@
</span><span class="cx"> # define YYUSE(E) /* empty */
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> /* Identity function, used to suppress warnings about constant conditions. */
</span><span class="cx"> #ifndef lint
</span><span class="cx"> # define YYID(N) (N)
</span><span class="lines">@@ -503,9 +512,9 @@
</span><span class="cx"> /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
</span><span class="cx"> static const yytype_uint8 yyrline[] =
</span><span class="cx"> {
</span><del>- 0, 91, 91, 98, 99, 102, 105, 108, 111, 114,
- 117, 120, 123, 126, 129, 132, 135, 138, 141, 144,
- 157, 170, 173, 176, 179, 182, 185
</del><ins>+ 0, 97, 97, 104, 105, 108, 111, 114, 117, 120,
+ 123, 126, 129, 132, 135, 138, 141, 144, 147, 150,
+ 163, 176, 179, 182, 185, 188, 191
</ins><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -770,11 +779,7 @@
</span><span class="cx"> # else
</span><span class="cx"> YYUSE (yyoutput);
</span><span class="cx"> # endif
</span><del>- switch (yytype)
- {
- default:
- break;
- }
</del><ins>+ YYUSE (yytype);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1168,12 +1173,7 @@
</span><span class="cx"> yymsg = "Deleting";
</span><span class="cx"> YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
</span><span class="cx">
</span><del>- switch (yytype)
- {
-
- default:
- break;
- }
</del><ins>+ YYUSE (yytype);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsery"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx"> std::ostringstream stream;
</span><span class="cx"> stream << $1 << " % " << $3;
</span><span class="cx"> std::string text = stream.str();
</span><del>- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
</del><ins>+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
</ins><span class="cx"> context->token->location,
</span><span class="cx"> text.c_str());
</span><span class="cx"> YYABORT;
</span><span class="lines">@@ -165,7 +165,7 @@
</span><span class="cx"> std::ostringstream stream;
</span><span class="cx"> stream << $1 << " / " << $3;
</span><span class="cx"> std::string text = stream.str();
</span><del>- context->diagnostics->report(pp::Diagnostics::DIVISION_BY_ZERO,
</del><ins>+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
</ins><span class="cx"> context->token->location,
</span><span class="cx"> text.c_str());
</span><span class="cx"> YYABORT;
</span><span class="lines">@@ -207,7 +207,7 @@
</span><span class="cx"> unsigned int val = 0;
</span><span class="cx"> if (!token->uValue(&val))
</span><span class="cx"> {
</span><del>- context->diagnostics->report(pp::Diagnostics::INTEGER_OVERFLOW,
</del><ins>+ context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
</ins><span class="cx"> token->location, token->text);
</span><span class="cx"> }
</span><span class="cx"> *lvalp = static_cast<YYSTYPE>(val);
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx">
</span><span class="cx"> void yyerror(Context* context, const char* reason)
</span><span class="cx"> {
</span><del>- context->diagnostics->report(pp::Diagnostics::INVALID_EXPRESSION,
</del><ins>+ context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
</ins><span class="cx"> context->token->location,
</span><span class="cx"> reason);
</span><span class="cx"> }
</span><span class="lines">@@ -276,12 +276,12 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 2:
</span><del>- mDiagnostics->report(Diagnostics::OUT_OF_MEMORY, token->location, "");
</del><ins>+ mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default:
</span><span class="cx"> assert(false);
</span><del>- mDiagnostics->report(Diagnostics::INTERNAL_ERROR, token->location, "");
</del><ins>+ mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorPreprocessorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -81,11 +81,6 @@
</span><span class="cx"> mImpl->macroSet[name] = macro;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Preprocessor::setMaxTokenLength(size_t maxLength)
-{
- mImpl->tokenizer.setMaxTokenLength(maxLength);
-}
-
</del><span class="cx"> void Preprocessor::lex(Token* token)
</span><span class="cx"> {
</span><span class="cx"> bool validToken = false;
</span><span class="lines">@@ -115,5 +110,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-} // namespace pp
</del><ins>+void Preprocessor::setMaxTokenSize(size_t maxTokenSize)
+{
+ mImpl->tokenizer.setMaxTokenSize(maxTokenSize);
+}
</ins><span class="cx">
</span><ins>+} // namespace pp
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorPreprocessorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -37,15 +37,12 @@
</span><span class="cx"> bool init(size_t count, const char* const string[], const int length[]);
</span><span class="cx"> // Adds a pre-defined macro.
</span><span class="cx"> void predefineMacro(const char* name, int value);
</span><del>- // Sets maximum allowed token length.
- // If token length exceeds this limit,
- // the token text will be truncated to the given maximum length, and
- // TOKEN_TOO_LONG diagnostic will be generated.
- // The maximum length defaults to 256.
- void setMaxTokenLength(size_t maxLength);
</del><span class="cx">
</span><span class="cx"> void lex(Token* token);
</span><span class="cx">
</span><ins>+ // Set maximum preprocessor token size
+ void setMaxTokenSize(size_t maxTokenSize);
+
</ins><span class="cx"> private:
</span><span class="cx"> PP_DISALLOW_COPY_AND_ASSIGN(Preprocessor);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #line 16 "./Tokenizer.l"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2011-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">@@ -18,7 +18,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 35
</del><ins>+#define YY_FLEX_SUBMINOR_VERSION 37
</ins><span class="cx"> #if YY_FLEX_SUBMINOR_VERSION > 0
</span><span class="cx"> #define FLEX_BETA
</span><span class="cx"> #endif
</span><span class="lines">@@ -64,7 +64,6 @@
</span><span class="cx"> typedef unsigned char flex_uint8_t;
</span><span class="cx"> typedef unsigned short int flex_uint16_t;
</span><span class="cx"> typedef unsigned int flex_uint32_t;
</span><del>-#endif /* ! C99 */
</del><span class="cx">
</span><span class="cx"> /* Limits of integral types. */
</span><span class="cx"> #ifndef INT8_MIN
</span><span class="lines">@@ -95,6 +94,8 @@
</span><span class="cx"> #define UINT32_MAX (4294967295U)
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#endif /* ! C99 */
+
</ins><span class="cx"> #endif /* ! FLEXINT_H */
</span><span class="cx">
</span><span class="cx"> #ifdef __cplusplus
</span><span class="lines">@@ -185,6 +186,11 @@
</span><span class="cx"> typedef size_t yy_size_t;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
</ins><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><span class="lines">@@ -335,7 +341,7 @@
</span><span class="cx">
</span><span class="cx"> /* Begin user sect3 */
</span><span class="cx">
</span><del>-#define ppwrap(n) 1
</del><ins>+#define ppwrap(yyscanner) 1
</ins><span class="cx"> #define YY_SKIP_YYWRAP
</span><span class="cx">
</span><span class="cx"> typedef unsigned char YY_CHAR;
</span><span class="lines">@@ -368,17 +374,19 @@
</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[87] =
</del><ins>+static yyconst flex_int16_t yy_accept[98] =
</ins><span class="cx"> { 0,
</span><span class="cx"> 0, 0, 0, 0, 39, 37, 34, 35, 35, 33,
</span><span class="cx"> 7, 33, 33, 33, 33, 33, 33, 33, 33, 9,
</span><span class="cx"> 9, 33, 33, 33, 8, 37, 33, 33, 3, 5,
</span><span class="cx"> 5, 4, 34, 35, 19, 27, 20, 30, 25, 12,
</span><span class="cx"> 23, 13, 24, 10, 2, 1, 26, 10, 9, 11,
</span><del>- 11, 11, 11, 9, 14, 16, 18, 17, 15, 8,
- 36, 36, 31, 21, 32, 22, 3, 5, 6, 11,
- 10, 11, 1, 10, 11, 0, 10, 9, 28, 29,
- 0, 10, 10, 10, 10, 0
</del><ins>+ 11, 11, 9, 11, 9, 9, 14, 16, 18, 17,
+ 15, 8, 36, 36, 31, 21, 32, 22, 3, 5,
+ 6, 11, 10, 11, 10, 1, 10, 11, 10, 0,
+ 10, 9, 9, 9, 28, 29, 0, 10, 10, 10,
+ 10, 9, 10, 10, 9, 10, 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">@@ -389,14 +397,14 @@
</span><span class="cx"> 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
</span><span class="cx"> 9, 10, 11, 9, 12, 13, 14, 15, 16, 16,
</span><span class="cx"> 16, 16, 16, 16, 16, 17, 17, 9, 9, 18,
</span><del>- 19, 20, 9, 1, 21, 21, 21, 21, 22, 21,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 24, 23, 23,
- 9, 25, 9, 26, 23, 1, 21, 21, 21, 21,
</del><ins>+ 19, 20, 9, 1, 21, 21, 21, 21, 22, 23,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 25, 24, 24, 26, 24, 24,
+ 9, 27, 9, 28, 24, 1, 21, 21, 21, 21,
</ins><span class="cx">
</span><del>- 22, 21, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 24,
- 23, 23, 9, 27, 9, 9, 1, 1, 1, 1,
</del><ins>+ 22, 23, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 25, 24, 24, 26,
+ 24, 24, 9, 29, 9, 9, 1, 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, 1, 1, 1, 1, 1, 1,
</span><span class="cx"> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
</span><span class="lines">@@ -413,89 +421,101 @@
</span><span class="cx"> 1, 1, 1, 1, 1
</span><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int32_t yy_meta[28] =
</del><ins>+static yyconst flex_int32_t yy_meta[30] =
</ins><span class="cx"> { 0,
</span><span class="cx"> 1, 1, 2, 2, 1, 1, 1, 1, 1, 3,
</span><span class="cx"> 1, 1, 4, 1, 5, 5, 5, 1, 1, 1,
</span><del>- 5, 5, 5, 5, 1, 1, 1
</del><ins>+ 5, 5, 5, 5, 5, 5, 1, 1, 1
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_base[92] =
</del><ins>+static yyconst flex_int16_t yy_base[103] =
</ins><span class="cx"> { 0,
</span><del>- 0, 0, 25, 27, 162, 163, 159, 163, 152, 132,
- 163, 131, 24, 163, 116, 22, 26, 31, 30, 37,
- 40, 44, 115, 46, 0, 64, 50, 15, 0, 163,
- 124, 91, 88, 163, 163, 163, 163, 163, 163, 163,
- 163, 163, 163, 64, 163, 0, 163, 76, 54, 58,
- 79, 91, 91, 0, 56, 163, 163, 163, 32, 0,
- 163, 36, 163, 163, 163, 163, 0, 163, 163, 94,
- 0, 106, 0, 0, 113, 55, 72, 113, 163, 163,
- 116, 101, 108, 123, 126, 163, 143, 31, 148, 153,
- 155
</del><ins>+ 0, 0, 27, 29, 137, 194, 133, 194, 117, 100,
+ 194, 98, 26, 194, 94, 24, 28, 33, 32, 39,
+ 51, 39, 80, 50, 0, 68, 25, 54, 0, 194,
+ 88, 71, 80, 194, 194, 194, 194, 194, 194, 194,
+ 194, 194, 194, 71, 194, 0, 194, 85, 55, 64,
+ 99, 111, 53, 105, 0, 50, 55, 194, 194, 194,
+ 40, 0, 194, 38, 194, 194, 194, 194, 0, 194,
+ 194, 117, 0, 130, 0, 0, 0, 137, 0, 88,
+ 113, 0, 131, 0, 194, 194, 143, 139, 152, 150,
+ 0, 13, 153, 194, 0, 194, 194, 176, 31, 181,
</ins><span class="cx">
</span><ins>+ 186, 188
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_def[92] =
</del><ins>+static yyconst flex_int16_t yy_def[103] =
</ins><span class="cx"> { 0,
</span><del>- 86, 1, 87, 87, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 20, 86, 86, 86, 88, 86, 86, 86, 89, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 90, 86, 86, 20, 20,
- 48, 51, 91, 21, 86, 86, 86, 86, 86, 88,
- 86, 86, 86, 86, 86, 86, 89, 86, 86, 44,
- 44, 70, 90, 48, 51, 86, 52, 91, 86, 86,
- 86, 72, 75, 86, 86, 0, 86, 86, 86, 86,
- 86
</del><ins>+ 97, 1, 98, 98, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 20, 97, 97, 97, 99, 97, 97, 97, 100, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 101, 97, 97, 20, 20,
+ 50, 51, 51, 102, 21, 51, 97, 97, 97, 97,
+ 97, 99, 97, 97, 97, 97, 97, 97, 100, 97,
+ 97, 44, 44, 72, 72, 101, 48, 51, 51, 97,
+ 52, 51, 102, 51, 97, 97, 97, 74, 78, 97,
+ 51, 51, 97, 97, 51, 97, 0, 97, 97, 97,
</ins><span class="cx">
</span><ins>+ 97, 97
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_nxt[191] =
</del><ins>+static yyconst flex_int16_t yy_nxt[224] =
</ins><span class="cx"> { 0,
</span><span class="cx"> 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
</span><span class="cx"> 16, 17, 18, 19, 20, 21, 21, 22, 23, 24,
</span><del>- 25, 25, 25, 25, 26, 27, 28, 30, 31, 30,
- 31, 37, 40, 65, 32, 60, 32, 42, 61, 45,
- 41, 66, 38, 46, 43, 44, 44, 44, 47, 48,
- 80, 49, 49, 50, 54, 54, 54, 51, 52, 51,
- 53, 55, 56, 51, 58, 59, 61, 62, 63, 84,
- 84, 84, 50, 50, 79, 64, 70, 51, 71, 71,
- 71, 51, 86, 86, 70, 72, 70, 70, 51, 33,
- 74, 74, 74, 51, 51, 51, 51, 75, 51, 51,
</del><ins>+ 25, 25, 25, 25, 25, 25, 26, 27, 28, 30,
+ 31, 30, 31, 37, 40, 62, 32, 95, 32, 42,
+ 63, 45, 41, 65, 38, 46, 43, 44, 44, 44,
+ 47, 48, 66, 49, 49, 50, 57, 58, 86, 51,
+ 52, 51, 51, 53, 54, 55, 55, 55, 60, 61,
+ 63, 64, 67, 85, 84, 56, 51, 82, 50, 50,
+ 51, 33, 68, 72, 71, 73, 73, 73, 51, 51,
+ 70, 72, 74, 75, 72, 72, 72, 51, 59, 77,
</ins><span class="cx">
</span><del>- 51, 76, 76, 51, 69, 77, 77, 77, 70, 70,
- 70, 86, 86, 51, 51, 70, 81, 81, 86, 86,
- 82, 82, 82, 81, 81, 51, 68, 83, 83, 83,
- 85, 85, 85, 57, 39, 51, 51, 84, 84, 84,
- 85, 85, 85, 29, 29, 29, 29, 29, 67, 36,
- 35, 67, 67, 73, 34, 73, 73, 73, 78, 78,
- 33, 86, 5, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86
</del><ins>+ 77, 77, 90, 90, 90, 51, 78, 79, 51, 51,
+ 51, 51, 39, 51, 51, 51, 36, 51, 35, 34,
+ 51, 80, 80, 97, 97, 81, 81, 81, 51, 51,
+ 51, 72, 72, 72, 33, 91, 97, 97, 72, 72,
+ 87, 87, 97, 51, 88, 88, 88, 87, 87, 97,
+ 97, 89, 89, 89, 51, 92, 51, 93, 93, 93,
+ 97, 75, 97, 97, 90, 90, 90, 93, 93, 93,
+ 97, 97, 94, 97, 79, 96, 29, 29, 29, 29,
+ 29, 69, 97, 97, 69, 69, 76, 97, 76, 76,
+ 76, 83, 83, 5, 97, 97, 97, 97, 97, 97,
+
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_chk[191] =
</del><ins>+static yyconst flex_int16_t yy_chk[224] =
</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><del>- 1, 1, 1, 1, 1, 1, 1, 3, 3, 4,
- 4, 13, 16, 28, 3, 88, 4, 17, 62, 19,
- 16, 28, 13, 19, 17, 18, 18, 18, 19, 20,
- 59, 20, 20, 20, 21, 21, 21, 20, 20, 20,
- 20, 22, 22, 21, 24, 24, 26, 26, 27, 76,
- 76, 76, 50, 50, 55, 27, 44, 49, 44, 44,
- 44, 50, 77, 77, 44, 44, 44, 44, 48, 33,
- 48, 48, 48, 51, 51, 51, 48, 48, 48, 48,
</del><ins>+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
+ 3, 4, 4, 13, 16, 99, 3, 92, 4, 17,
+ 64, 19, 16, 27, 13, 19, 17, 18, 18, 18,
+ 19, 20, 27, 20, 20, 20, 22, 22, 61, 20,
+ 20, 20, 20, 20, 20, 21, 21, 21, 24, 24,
+ 26, 26, 28, 57, 56, 21, 21, 53, 50, 50,
+ 49, 33, 28, 44, 32, 44, 44, 44, 50, 50,
+ 31, 44, 44, 44, 44, 44, 44, 48, 23, 48,
</ins><span class="cx">
</span><del>- 51, 52, 52, 53, 32, 52, 52, 52, 70, 70,
- 70, 82, 82, 53, 53, 70, 72, 72, 83, 83,
- 72, 72, 72, 75, 75, 78, 31, 75, 75, 75,
- 81, 81, 81, 23, 15, 78, 78, 84, 84, 84,
- 85, 85, 85, 87, 87, 87, 87, 87, 89, 12,
- 10, 89, 89, 90, 9, 90, 90, 90, 91, 91,
- 7, 5, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86
</del><ins>+ 48, 48, 80, 80, 80, 48, 48, 48, 48, 48,
+ 48, 51, 15, 51, 51, 51, 12, 54, 10, 9,
+ 51, 52, 52, 81, 81, 52, 52, 52, 54, 54,
+ 54, 72, 72, 72, 7, 81, 5, 0, 72, 72,
+ 74, 74, 0, 83, 74, 74, 74, 78, 78, 88,
+ 88, 78, 78, 78, 83, 83, 83, 87, 87, 87,
+ 0, 88, 89, 89, 90, 90, 90, 93, 93, 93,
+ 0, 0, 90, 0, 89, 93, 98, 98, 98, 98,
+ 98, 100, 0, 0, 100, 100, 101, 0, 101, 101,
+ 101, 102, 102, 97, 97, 97, 97, 97, 97, 97,
+
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97
</ins><span class="cx"> } ;
</span><span class="cx">
</span><span class="cx"> /* The intent behind this definition is that it'll catch
</span><span class="lines">@@ -507,7 +527,7 @@
</span><span class="cx"> #define YY_RESTORE_YY_MORE_OFFSET
</span><span class="cx"> /*
</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">@@ -652,6 +672,10 @@
</span><span class="cx">
</span><span class="cx"> void ppset_lineno (int line_number ,yyscan_t yyscanner );
</span><span class="cx">
</span><ins>+int ppget_column (yyscan_t yyscanner );
+
+void ppset_column (int column_no ,yyscan_t yyscanner );
+
</ins><span class="cx"> YYSTYPE * ppget_lval (yyscan_t yyscanner );
</span><span class="cx">
</span><span class="cx"> void ppset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
</span><span class="lines">@@ -702,7 +726,7 @@
</span><span class="cx"> /* This used to be an fputs(), but since the string might contain NUL's,
</span><span class="cx"> * we now use fwrite().
</span><span class="cx"> */
</span><del>-#define ECHO fwrite( yytext, yyleng, 1, yyout )
</del><ins>+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
</span><span class="lines">@@ -713,7 +737,7 @@
</span><span class="cx">         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
</span><span class="cx">                 { \
</span><span class="cx">                 int c = '*'; \
</span><del>-                yy_size_t n; \
</del><ins>+                size_t n; \
</ins><span class="cx">                 for ( n = 0; n < max_size && \
</span><span class="cx">                          (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
</span><span class="cx">                         buf[n] = (char) c; \
</span><span class="lines">@@ -855,13 +879,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 >= 87 )
</del><ins>+                                if ( yy_current_state >= 98 )
</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 != 86 );
</del><ins>+                while ( yy_current_state != 97 );
</ins><span class="cx">                 yy_cp = yyg->yy_last_accepting_cpos;
</span><span class="cx">                 yy_current_state = yyg->yy_last_accepting_state;
</span><span class="cx">
</span><span class="lines">@@ -1354,7 +1378,7 @@
</span><span class="cx">                         { /* Not enough room in the buffer - grow it. */
</span><span class="cx">
</span><span class="cx">                         /* just a shorter name for the current buffer */
</span><del>-                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
</del><ins>+                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
</ins><span class="cx">
</span><span class="cx">                         int yy_c_buf_p_offset =
</span><span class="cx">                                 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
</span><span class="lines">@@ -1454,7 +1478,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 >= 87 )
</del><ins>+                        if ( yy_current_state >= 98 )
</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">@@ -1483,12 +1507,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 >= 87 )
</del><ins>+                if ( yy_current_state >= 98 )
</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 == 86);
</del><ins>+        yy_is_jam = (yy_current_state == 97);
</ins><span class="cx">
</span><ins>+        (void)yyg;
</ins><span class="cx">         return yy_is_jam ? 0 : yy_current_state;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1890,8 +1915,8 @@
</span><span class="cx">
</span><span class="cx"> /** Setup the input buffer state to scan the given bytes. The next call to pplex() will
</span><span class="cx"> * scan from a @e copy of @a bytes.
</span><del>- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
</del><ins>+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
</ins><span class="cx"> * @param yyscanner The scanner object.
</span><span class="cx"> * @return the newly allocated buffer state object.
</span><span class="cx"> */
</span><span class="lines">@@ -1899,7 +1924,8 @@
</span><span class="cx"> {
</span><span class="cx">         YY_BUFFER_STATE b;
</span><span class="cx">         char *buf;
</span><del>-        yy_size_t n, i;
</del><ins>+        yy_size_t n;
+        yy_size_t i;
</ins><span class="cx">
</span><span class="cx">         /* Get memory for full buffer, including space for trailing EOB's. */
</span><span class="cx">         n = _yybytes_len + 2;
</span><span class="lines">@@ -2045,7 +2071,7 @@
</span><span class="cx">
</span><span class="cx"> /* lineno is only valid if an input buffer exists. */
</span><span class="cx"> if (! YY_CURRENT_BUFFER )
</span><del>- yy_fatal_error( "ppset_lineno called with no buffer" , yyscanner);
</del><ins>+ YY_FATAL_ERROR( "ppset_lineno called with no buffer" );
</ins><span class="cx">
</span><span class="cx"> yylineno = line_number;
</span><span class="cx"> }
</span><span class="lines">@@ -2060,7 +2086,7 @@
</span><span class="cx">
</span><span class="cx"> /* column is only valid if an input buffer exists. */
</span><span class="cx"> if (! YY_CURRENT_BUFFER )
</span><del>- yy_fatal_error( "ppset_column called with no buffer" , yyscanner);
</del><ins>+ YY_FATAL_ERROR( "ppset_column called with no buffer" );
</ins><span class="cx">
</span><span class="cx"> yycolumn = column_no;
</span><span class="cx"> }
</span><span class="lines">@@ -2304,7 +2330,7 @@
</span><span class="cx">
</span><span class="cx"> Tokenizer::Tokenizer(Diagnostics* diagnostics)
</span><span class="cx"> : mHandle(0),
</span><del>- mMaxTokenLength(256)
</del><ins>+ mMaxTokenSize(256)
</ins><span class="cx"> {
</span><span class="cx"> mContext.diagnostics = diagnostics;
</span><span class="cx"> }
</span><span class="lines">@@ -2334,14 +2360,19 @@
</span><span class="cx"> ppset_lineno(line,mHandle);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
+{
+ mMaxTokenSize = maxTokenSize;
+}
+
</ins><span class="cx"> void Tokenizer::lex(Token* token)
</span><span class="cx"> {
</span><span class="cx"> token->type = pplex(&token->text,&token->location,mHandle);
</span><del>- if (token->text.size() > mMaxTokenLength)
</del><ins>+ if (token->text.size() > mMaxTokenSize)
</ins><span class="cx"> {
</span><span class="cx"> mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
</span><span class="cx"> token->location, token->text);
</span><del>- token->text.erase(mMaxTokenLength);
</del><ins>+ token->text.erase(mMaxTokenSize);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> token->flags = 0;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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">@@ -38,9 +38,9 @@
</span><span class="cx">
</span><span class="cx"> bool init(size_t count, const char* const string[], const int length[]);
</span><span class="cx">
</span><del>- void setMaxTokenLength(size_t maxLength) { mMaxTokenLength = maxLength; }
</del><span class="cx"> void setFileNumber(int file);
</span><span class="cx"> void setLineNumber(int line);
</span><ins>+ void setMaxTokenSize(size_t maxTokenSize);
</ins><span class="cx">
</span><span class="cx"> virtual void lex(Token* token);
</span><span class="cx">
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">
</span><span class="cx"> void* mHandle; // Scanner handle.
</span><span class="cx"> Context mContext; // Scanner extra.
</span><del>- size_t mMaxTokenLength;
</del><ins>+ size_t mMaxTokenSize; // Maximum token size
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace pp
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizerl"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</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">@@ -14,7 +14,7 @@
</span><span class="cx">
</span><span class="cx"> %top{
</span><span class="cx"> //
</span><del>-// Copyright (c) 2011-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2011-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">@@ -33,6 +33,12 @@
</span><span class="cx"> #pragma GCC diagnostic ignored "-Wmissing-noreturn"
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wdeprecated-register"
+#endif
+
</ins><span class="cx"> typedef std::string YYSTYPE;
</span><span class="cx"> typedef pp::SourceLocation YYLTYPE;
</span><span class="cx">
</span><span class="lines">@@ -78,9 +84,9 @@
</span><span class="cx"> IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
</span><span class="cx"> PUNCTUATOR [][<>(){}.+-/*%^|&~=!:;,?]
</span><span class="cx">
</span><del>-DECIMAL_CONSTANT [1-9][0-9]*
-OCTAL_CONSTANT 0[0-7]*
-HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+
</del><ins>+DECIMAL_CONSTANT [1-9][0-9]*[uU]?
+OCTAL_CONSTANT 0[0-7]*[uU]?
+HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+[uU]?
</ins><span class="cx">
</span><span class="cx"> DIGIT [0-9]
</span><span class="cx"> EXPONENT_PART [eE][+-]?{DIGIT}+
</span><span class="lines">@@ -114,12 +120,12 @@
</span><span class="cx"> return pp::Token::IDENTIFIER;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-{DECIMAL_CONSTANT}|{OCTAL_CONSTANT}|{HEXADECIMAL_CONSTANT} {
</del><ins>+({DECIMAL_CONSTANT}[uU]?)|({OCTAL_CONSTANT}[uU]?)|({HEXADECIMAL_CONSTANT}[uU]?) {
</ins><span class="cx"> yylval->assign(yytext, yyleng);
</span><span class="cx"> return pp::Token::CONST_INT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-({DIGIT}+{EXPONENT_PART})|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?) {
</del><ins>+({DIGIT}+{EXPONENT_PART}[fF]?)|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?[fF]?) {
</ins><span class="cx"> yylval->assign(yytext, yyleng);
</span><span class="cx"> return pp::Token::CONST_FLOAT;
</span><span class="cx"> }
</span><span class="lines">@@ -256,7 +262,7 @@
</span><span class="cx">
</span><span class="cx"> if (YY_START == COMMENT)
</span><span class="cx"> {
</span><del>- yyextra->diagnostics->report(pp::Diagnostics::EOF_IN_COMMENT,
</del><ins>+ yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
</ins><span class="cx"> pp::SourceLocation(yyfileno, yylineno),
</span><span class="cx"> "");
</span><span class="cx"> }
</span><span class="lines">@@ -265,11 +271,13 @@
</span><span class="cx">
</span><span class="cx"> %%
</span><span class="cx">
</span><ins>+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
</ins><span class="cx"> namespace pp {
</span><span class="cx">
</span><del>-Tokenizer::Tokenizer(Diagnostics* diagnostics)
- : mHandle(0),
- mMaxTokenLength(256)
</del><ins>+Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
</ins><span class="cx"> {
</span><span class="cx"> mContext.diagnostics = diagnostics;
</span><span class="cx"> }
</span><span class="lines">@@ -299,14 +307,19 @@
</span><span class="cx"> yyset_lineno(line, mHandle);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
+{
+ mMaxTokenSize = maxTokenSize;
+}
+
</ins><span class="cx"> void Tokenizer::lex(Token* token)
</span><span class="cx"> {
</span><span class="cx"> token->type = yylex(&token->text, &token->location, mHandle);
</span><del>- if (token->text.size() > mMaxTokenLength)
</del><ins>+ if (token->text.size() > mMaxTokenSize)
</ins><span class="cx"> {
</span><del>- mContext.diagnostics->report(Diagnostics::TOKEN_TOO_LONG,
</del><ins>+ mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
</ins><span class="cx"> token->location, token->text);
</span><del>- token->text.erase(mMaxTokenLength);
</del><ins>+ token->text.erase(mMaxTokenSize);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> token->flags = 0;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslator64bitlexersafetypatch"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,177 @@
</span><ins>+--- a/src/compiler/glslang_lex.cpp
++++ b/src/compiler/glslang_lex.cpp
+@@ -68,6 +68,7 @@ typedef int16_t flex_int16_t;
+ typedef uint16_t flex_uint16_t;
+ typedef int32_t flex_int32_t;
+ typedef uint32_t flex_uint32_t;
++typedef uint64_t flex_uint64_t;
+ #else
+ typedef signed char flex_int8_t;
+ typedef short int flex_int16_t;
+@@ -191,6 +192,11 @@ typedef void* yyscan_t;
+ typedef struct yy_buffer_state *YY_BUFFER_STATE;
+ #endif
+
++#ifndef YY_TYPEDEF_YY_SIZE_T
++#define YY_TYPEDEF_YY_SIZE_T
++typedef size_t yy_size_t;
++#endif
++
+ #define EOB_ACT_CONTINUE_SCAN 0
+ #define EOB_ACT_END_OF_FILE 1
+ #define EOB_ACT_LAST_MATCH 2
+@@ -204,7 +210,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+- int yyl;\
++ yy_size_t yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+@@ -226,11 +232,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+ #define unput(c) yyunput( c, yyg->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 "own" 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 );
+@@ -378,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
+ */
+ #define YY_DO_BEFORE_ACTION \
+         yyg->yytext_ptr = yy_bp; \
+-        yyleng = (size_t) (yy_cp - yy_bp); \
++        yyleng = (yy_size_t) (yy_cp - yy_bp); \
+         yyg->yy_hold_char = *yy_cp; \
+         *yy_cp = '\0'; \
+         yyg->yy_c_buf_p = yy_cp;
+@@ -1035,8 +1036,8 @@ struct yyguts_t
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ YY_BUFFER_STATE * yy_buffer_stack; /**< 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->yy_is_interactive ) \
+                 { \
+                 int c = '*'; \
+-                int n; \
++                yy_size_t n; \
+                 for ( n = 0; n < max_size && \
+                          (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+                         buf[n] = (char) c; \
+@@ -1317,7 +1318,7 @@ yy_find_action:
+
+                 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+                         {
+-                        int yyl;
++                        yy_size_t yyl;
+                         for ( yyl = 0; yyl < 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->yy_buf_size - number_to_move - 1;
+
+                 while ( num_to_read <= 0 )
+@@ -2217,7 +2218,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
+
+                         if ( b->yy_is_our_buffer )
+                                 {
+-                                int new_size = b->yy_buf_size * 2;
++                                yy_size_t new_size = b->yy_buf_size * 2;
+
+                                 if ( new_size <= 0 )
+                                         b->yy_buf_size += b->yy_buf_size / 8;
+@@ -2248,7 +2249,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
+
+                 /* Read in more data. */
+                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+-                        yyg->yy_n_chars, (size_t) num_to_read );
++                        yyg->yy_n_chars, num_to_read );
+
+                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+                 }
+@@ -2373,7 +2374,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
+
+                 else
+                         { /* need more input */
+-                        int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
++                        yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+                         ++yyg->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->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;
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBaseTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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,6 +7,8 @@
</span><span class="cx"> #ifndef _BASICTYPES_INCLUDED_
</span><span class="cx"> #define _BASICTYPES_INCLUDED_
</span><span class="cx">
</span><ins>+#include <assert.h>
+
</ins><span class="cx"> //
</span><span class="cx"> // Precision qualifiers
</span><span class="cx"> //
</span><span class="lines">@@ -23,10 +25,10 @@
</span><span class="cx"> {
</span><span class="cx"> switch(p)
</span><span class="cx"> {
</span><del>- case EbpHigh: return "highp"; break;
- case EbpMedium: return "mediump"; break;
- case EbpLow: return "lowp"; break;
- default: return "mediump"; break; // Safest fallback
</del><ins>+ case EbpHigh:                return "highp";                break;
+ case EbpMedium:                return "mediump";        break;
+ case EbpLow:                return "lowp";                break;
+ default:                        return "mediump"; break; // Safest fallback
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -38,14 +40,34 @@
</span><span class="cx"> EbtVoid,
</span><span class="cx"> EbtFloat,
</span><span class="cx"> EbtInt,
</span><ins>+ EbtUInt,
</ins><span class="cx"> EbtBool,
</span><del>- EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
</del><ins>+ EbtGVec4, // non type: represents vec4, ivec4 and uvec4
+ EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
</ins><span class="cx"> EbtSampler2D,
</span><ins>+ EbtSampler3D,
</ins><span class="cx"> EbtSamplerCube,
</span><ins>+ EbtSampler2DArray,
</ins><span class="cx"> EbtSamplerExternalOES, // Only valid if OES_EGL_image_external exists.
</span><span class="cx"> EbtSampler2DRect, // Only valid if GL_ARB_texture_rectangle exists.
</span><del>- EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
</del><ins>+ EbtISampler2D,
+ EbtISampler3D,
+ EbtISamplerCube,
+ EbtISampler2DArray,
+ EbtUSampler2D,
+ EbtUSampler3D,
+ EbtUSamplerCube,
+ EbtUSampler2DArray,
+ EbtSampler2DShadow,
+ EbtSamplerCubeShadow,
+ EbtSampler2DArrayShadow,
+ EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
+ 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><ins>+ EbtInterfaceBlock,
</ins><span class="cx"> EbtAddress, // should be deprecated??
</span><span class="cx"> EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
</span><span class="cx"> };
</span><span class="lines">@@ -54,16 +76,31 @@
</span><span class="cx"> {
</span><span class="cx"> switch (t)
</span><span class="cx"> {
</span><del>- case EbtVoid: return "void"; break;
- case EbtFloat: return "float"; break;
- case EbtInt: return "int"; break;
- case EbtBool: return "bool"; break;
- case EbtSampler2D: return "sampler2D"; break;
- case EbtSamplerCube: return "samplerCube"; break;
- case EbtSamplerExternalOES: return "samplerExternalOES"; break;
- case EbtSampler2DRect: return "sampler2DRect"; break;
- case EbtStruct: return "structure"; break;
- default: return "unknown type";
</del><ins>+ case EbtVoid: return "void"; break;
+ case EbtFloat: return "float"; break;
+ case EbtInt: return "int"; break;
+ case EbtUInt: return "uint"; break;
+ case EbtBool: return "bool"; break;
+ case EbtSampler2D: return "sampler2D"; break;
+ case EbtSampler3D: return "sampler3D"; break;
+ case EbtSamplerCube: return "samplerCube"; break;
+ case EbtSamplerExternalOES: return "samplerExternalOES"; break;
+ case EbtSampler2DRect: return "sampler2DRect"; break;
+ case EbtSampler2DArray: return "sampler2DArray"; break;
+ case EbtISampler2D: return "isampler2D"; break;
+ case EbtISampler3D: return "isampler3D"; break;
+ case EbtISamplerCube: return "isamplerCube"; break;
+ case EbtISampler2DArray: return "isampler2DArray"; break;
+ case EbtUSampler2D: return "usampler2D"; break;
+ case EbtUSampler3D: return "usampler3D"; break;
+ case EbtUSamplerCube: return "usamplerCube"; break;
+ case EbtUSampler2DArray: return "usampler2DArray"; break;
+ case EbtSampler2DShadow: return "sampler2DShadow"; break;
+ case EbtSamplerCubeShadow: return "samplerCubeShadow"; break;
+ case EbtSampler2DArrayShadow: return "sampler2DArrayShadow"; break;
+ case EbtStruct: return "structure"; break;
+ case EbtInterfaceBlock: return "interface block"; break;
+ default: return "unknown type";
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -72,6 +109,186 @@
</span><span class="cx"> return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline bool IsIntegerSampler(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ return true;
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSampler2D(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DRect:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ return true;
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCube:
+ case EbtSamplerCubeShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSamplerCube(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCubeShadow:
+ return true;
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSampler3D(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ return true;
+ case EbtSampler2D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtISampler2D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSamplerArray(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DArrayShadow:
+ return true;
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DRect:
+ case EbtSamplerExternalOES:
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCube:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsShadowSampler(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ return true;
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
</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">@@ -91,6 +308,11 @@
</span><span class="cx"> EvqInvariantVaryingOut, // vertex shaders only read/write
</span><span class="cx"> EvqUniform, // Readonly, vertex and fragment
</span><span class="cx">
</span><ins>+ EvqVertexIn, // Vertex shader input
+ EvqFragmentOut, // Fragment shader output
+ EvqVertexOut, // Vertex shader output
+ EvqFragmentIn, // Fragment shader input
+
</ins><span class="cx"> // parameters
</span><span class="cx"> EvqIn,
</span><span class="cx"> EvqOut,
</span><span class="lines">@@ -111,10 +333,58 @@
</span><span class="cx"> EvqFragData,
</span><span class="cx"> EvqFragDepth,
</span><span class="cx">
</span><ins>+ // GLSL ES 3.0 vertex output and fragment input
+ EvqSmooth, // Incomplete qualifier, smooth is the default
+ EvqFlat, // Incomplete qualifier
+ EvqSmoothOut = EvqSmooth,
+ EvqFlatOut = EvqFlat,
+ EvqCentroidOut, // Implies smooth
+ EvqSmoothIn,
+ EvqFlatIn,
+ EvqCentroidIn, // Implies smooth
+
</ins><span class="cx"> // end of list
</span><span class="cx"> EvqLast
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+enum TLayoutMatrixPacking
+{
+ EmpUnspecified,
+ EmpRowMajor,
+ EmpColumnMajor
+};
+
+enum TLayoutBlockStorage
+{
+ EbsUnspecified,
+ EbsShared,
+ EbsPacked,
+ EbsStd140
+};
+
+struct TLayoutQualifier
+{
+ int location;
+ TLayoutMatrixPacking matrixPacking;
+ TLayoutBlockStorage blockStorage;
+
+ static TLayoutQualifier create()
+ {
+ TLayoutQualifier layoutQualifier;
+
+ layoutQualifier.location = -1;
+ layoutQualifier.matrixPacking = EmpUnspecified;
+ layoutQualifier.blockStorage = EbsUnspecified;
+
+ return layoutQualifier;
+ }
+
+ bool isEmpty() const
+ {
+ return location == -1 && matrixPacking == EmpUnspecified && blockStorage == EbsUnspecified;
+ }
+};
+
</ins><span class="cx"> //
</span><span class="cx"> // This is just for debug print out, carried along with the definitions above.
</span><span class="cx"> //
</span><span class="lines">@@ -129,9 +399,13 @@
</span><span class="cx"> case EvqAttribute: return "attribute"; break;
</span><span class="cx"> case EvqVaryingIn: return "varying"; break;
</span><span class="cx"> case EvqVaryingOut: return "varying"; break;
</span><del>- case EvqInvariantVaryingIn: return "invariant varying"; break;
- case EvqInvariantVaryingOut:return "invariant varying"; break;
</del><ins>+ case EvqInvariantVaryingIn: return "invariant varying";        break;
+ case EvqInvariantVaryingOut:return "invariant varying";        break;
</ins><span class="cx"> case EvqUniform: return "uniform"; break;
</span><ins>+ case EvqVertexIn: return "in"; break;
+ case EvqFragmentOut: return "out"; break;
+ case EvqVertexOut: return "out"; break;
+ case EvqFragmentIn: return "in"; break;
</ins><span class="cx"> case EvqIn: return "in"; break;
</span><span class="cx"> case EvqOut: return "out"; break;
</span><span class="cx"> case EvqInOut: return "inout"; break;
</span><span class="lines">@@ -140,10 +414,53 @@
</span><span class="cx"> case EvqFragCoord: return "FragCoord"; break;
</span><span class="cx"> case EvqFrontFacing: return "FrontFacing"; break;
</span><span class="cx"> case EvqFragColor: return "FragColor"; break;
</span><del>- case EvqFragData: return "FragData"; break;
- case EvqFragDepth: return "FragDepth"; break;
</del><ins>+ case EvqFragData: return "FragData"; break;
+ case EvqFragDepth: return "FragDepth"; break;
+ case EvqSmoothOut: return "smooth out"; break;
+ case EvqCentroidOut: return "centroid out"; break;
+ case EvqFlatOut: return "flat out"; break;
+ case EvqSmoothIn: return "smooth in"; break;
+ case EvqCentroidIn: return "centroid in"; break;
+ case EvqFlatIn: return "flat in"; break;
</ins><span class="cx"> default: return "unknown qualifier";
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline const char* getMatrixPackingString(TLayoutMatrixPacking mpq)
+{
+ switch (mpq)
+ {
+ case EmpUnspecified: return "mp_unspecified";
+ case EmpRowMajor: return "row_major";
+ case EmpColumnMajor: return "column_major";
+ default: return "unknown matrix packing";
+ }
+}
+
+inline const char* getBlockStorageString(TLayoutBlockStorage bsq)
+{
+ switch (bsq)
+ {
+ case EbsUnspecified: return "bs_unspecified";
+ case EbsShared: return "shared";
+ case EbsPacked: return "packed";
+ case EbsStd140: return "std140";
+ default: return "unknown block storage";
+ }
+}
+
+inline const char* getInterpolationString(TQualifier q)
+{
+ switch(q)
+ {
+ case EvqSmoothOut: return "smooth"; break;
+ case EvqCentroidOut: return "centroid"; break;
+ case EvqFlatOut: return "flat"; break;
+ case EvqSmoothIn: return "smooth"; break;
+ case EvqCentroidIn: return "centroid"; break;
+ case EvqFlatIn: return "flat"; break;
+ default: return "unknown interpolation";
+ }
+}
+
</ins><span class="cx"> #endif // _BASICTYPES_INCLUDED_
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx"> BuiltInFunctionEmulator::IdentifyFunction(
</span><span class="cx"> TOperator op, const TType& param)
</span><span class="cx"> {
</span><del>- if (param.getNominalSize() > 4)
</del><ins>+ if (param.getNominalSize() > 4 || param.getSecondarySize() > 4)
</ins><span class="cx"> return TFunctionUnknown;
</span><span class="cx"> unsigned int function = TFunctionUnknown;
</span><span class="cx"> switch (op) {
</span><span class="lines">@@ -356,9 +356,9 @@
</span><span class="cx"> {
</span><span class="cx"> // Right now for all the emulated functions with two parameters, the two
</span><span class="cx"> // parameters have the same type.
</span><del>- if (param1.isVector() != param2.isVector() ||
- param1.getNominalSize() != param2.getNominalSize() ||
- param1.getNominalSize() > 4)
</del><ins>+ if (param1.getNominalSize() != param2.getNominalSize() ||
+ param1.getSecondarySize() != param2.getSecondarySize() ||
+ param1.getNominalSize() > 4 || param1.getSecondarySize() > 4)
</ins><span class="cx"> return TFunctionUnknown;
</span><span class="cx">
</span><span class="cx"> unsigned int function = TFunctionUnknown;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,8 +7,6 @@
</span><span class="cx"> #ifndef COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
</span><span class="cx"> #define COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
-
</del><span class="cx"> #include "compiler/translator/InfoSink.h"
</span><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCodeGencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CodeGen.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CodeGen.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CodeGen.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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) 2013 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">@@ -17,14 +17,14 @@
</span><span class="cx"> ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
</span><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:
</del><ins>+ case SH_GLSL_OUTPUT:
</ins><span class="cx"> return new TranslatorGLSL(type, spec);
</span><del>- case SH_HLSL9_OUTPUT:
- case SH_HLSL11_OUTPUT:
</del><ins>+ case SH_HLSL9_OUTPUT:
+ case SH_HLSL11_OUTPUT:
</ins><span class="cx"> return new TranslatorHLSL(type, spec, output);
</span><del>- default:
</del><ins>+ default:
</ins><span class="cx"> return NULL;
</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 (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -46,8 +46,8 @@
</span><span class="cx"> typedef std::basic_ostringstream<char, std::char_traits<char>, TStringAllocator> TStringStream;
</span><span class="cx"> inline TString* NewPoolTString(const char* s)
</span><span class="cx"> {
</span><del>- void* memory = GetGlobalPoolAllocator()->allocate(sizeof(TString));
- return new(memory) TString(s);
</del><ins>+        void* memory = GetGlobalPoolAllocator()->allocate(sizeof(TString));
+        return new(memory) TString(s);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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">@@ -10,12 +10,12 @@
</span><span class="cx"> #include "compiler/translator/Initialize.h"
</span><span class="cx"> #include "compiler/translator/InitializeParseContext.h"
</span><span class="cx"> #include "compiler/translator/InitializeVariables.h"
</span><del>-#include "compiler/translator/MapLongVariableNames.h"
</del><span class="cx"> #include "compiler/translator/ParseContext.h"
</span><span class="cx"> #include "compiler/translator/RenameFunction.h"
</span><span class="cx"> #include "compiler/translator/ShHandle.h"
</span><span class="cx"> #include "compiler/translator/UnfoldShortCircuitAST.h"
</span><span class="cx"> #include "compiler/translator/ValidateLimitations.h"
</span><ins>+#include "compiler/translator/ValidateOutputs.h"
</ins><span class="cx"> #include "compiler/translator/VariablePacker.h"
</span><span class="cx"> #include "compiler/translator/depgraph/DependencyGraph.h"
</span><span class="cx"> #include "compiler/translator/depgraph/DependencyGraphOutput.h"
</span><span class="lines">@@ -23,11 +23,25 @@
</span><span class="cx"> #include "compiler/translator/timing/RestrictVertexShaderTiming.h"
</span><span class="cx"> #include "third_party/compiler/ArrayBoundsClamper.h"
</span><span class="cx">
</span><del>-bool isWebGLBasedSpec(ShShaderSpec spec)
</del><ins>+bool IsWebGLBasedSpec(ShShaderSpec spec)
</ins><span class="cx"> {
</span><span class="cx"> return spec == SH_WEBGL_SPEC || spec == SH_CSS_SHADERS_SPEC;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+size_t GetGlobalMaxTokenSize(ShShaderSpec spec)
+{
+ // WebGL defines a max token legnth of 256, while ES2 leaves max token
+ // size undefined. ES3 defines a max size of 1024 characters.
+ if (IsWebGLBasedSpec(spec))
+ {
+ return 256;
+ }
+ else
+ {
+ return 1024;
+ }
+}
+
</ins><span class="cx"> namespace {
</span><span class="cx"> class TScopedPoolAllocator
</span><span class="cx"> {
</span><span class="lines">@@ -89,17 +103,15 @@
</span><span class="cx"> clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
</span><span class="cx"> builtInFunctionEmulator(type)
</span><span class="cx"> {
</span><del>- longNameMap = LongNameMap::GetInstance();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TCompiler::~TCompiler()
</span><span class="cx"> {
</span><del>- ASSERT(longNameMap);
- longNameMap->Release();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool TCompiler::Init(const ShBuiltInResources& resources)
</span><span class="cx"> {
</span><ins>+ shaderVersion = 100;
</ins><span class="cx"> maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
</span><span class="cx"> resources.MaxVertexUniformVectors :
</span><span class="cx"> resources.MaxFragmentUniformVectors;
</span><span class="lines">@@ -134,7 +146,7 @@
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> // If compiling for WebGL, validate loop and indexing as well.
</span><del>- if (isWebGLBasedSpec(shaderSpec))
</del><ins>+ if (IsWebGLBasedSpec(shaderSpec))
</ins><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><span class="lines">@@ -161,14 +173,24 @@
</span><span class="cx"> bool success =
</span><span class="cx"> (PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], NULL, &parseContext) == 0) &&
</span><span class="cx"> (parseContext.treeRoot != NULL);
</span><ins>+
+ shaderVersion = parseContext.getShaderVersion();
+
</ins><span class="cx"> if (success)
</span><span class="cx"> {
</span><span class="cx"> TIntermNode* root = parseContext.treeRoot;
</span><span class="cx"> success = intermediate.postProcess(root);
</span><span class="cx">
</span><ins>+ // Disallow expressions deemed too complex.
+ if (success && (compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY))
+ success = limitExpressionComplexity(root);
+
</ins><span class="cx"> if (success)
</span><span class="cx"> success = detectCallDepth(root, infoSink, (compileOptions & SH_LIMIT_CALL_STACK_DEPTH) != 0);
</span><span class="cx">
</span><ins>+ if (success && shaderVersion == 300 && shaderType == SH_FRAGMENT_SHADER)
+ success = validateOutputs(root);
+
</ins><span class="cx"> if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
</span><span class="cx"> success = validateLimitations(root);
</span><span class="cx">
</span><span class="lines">@@ -180,7 +202,21 @@
</span><span class="cx">
</span><span class="cx"> // Unroll for-loop markup needs to happen after validateLimitations pass.
</span><span class="cx"> if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX))
</span><del>- ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(root);
</del><ins>+ {
+ ForLoopUnrollMarker marker(ForLoopUnrollMarker::kIntegerIndex);
+ root->traverse(&marker);
+ }
+ if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX))
+ {
+ ForLoopUnrollMarker marker(ForLoopUnrollMarker::kSamplerArrayIndex);
+ root->traverse(&marker);
+ if (marker.samplerArrayIndexIsFloatLoopIndex())
+ {
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "sampler array index is float loop index";
+ success = false;
+ }
+ }
</ins><span class="cx">
</span><span class="cx"> // Built-in function emulation needs to happen after validateLimitations pass.
</span><span class="cx"> if (success && (compileOptions & SH_EMULATE_BUILT_IN_FUNCTIONS))
</span><span class="lines">@@ -190,17 +226,6 @@
</span><span class="cx"> if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
</span><span class="cx"> arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
</span><span class="cx">
</span><del>- // Disallow expressions deemed too complex.
- if (success && (compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY))
- success = limitExpressionComplexity(root);
-
- // Call mapLongVariableNames() before collectAttribsUniforms() so in
- // collectAttribsUniforms() we already have the mapped symbol names and
- // we could composite mapped and original variable names.
- // Also, if we hash all the names, then no need to do this for long names.
- if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
- mapLongVariableNames(root);
-
</del><span class="cx"> if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
</span><span class="cx"> initializeGLPosition(root);
</span><span class="cx">
</span><span class="lines">@@ -216,7 +241,6 @@
</span><span class="cx"> collectVariables(root);
</span><span class="cx"> if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
</span><span class="cx"> success = enforcePackingRestrictions();
</span><del>-
</del><span class="cx"> if (success && shaderType == SH_VERTEX_SHADER &&
</span><span class="cx"> (compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
</span><span class="cx"> initializeVaryingsWithoutStaticUse(root);
</span><span class="lines">@@ -231,7 +255,7 @@
</span><span class="cx">
</span><span class="cx"> // Cleanup memory.
</span><span class="cx"> intermediate.remove(parseContext.treeRoot);
</span><del>-
</del><ins>+ SetGlobalParseContext(NULL);
</ins><span class="cx"> return success;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -240,23 +264,25 @@
</span><span class="cx"> compileResources = resources;
</span><span class="cx">
</span><span class="cx"> assert(symbolTable.isEmpty());
</span><del>- symbolTable.push();
</del><ins>+ symbolTable.push(); // COMMON_BUILTINS
+ symbolTable.push(); // ESSL1_BUILTINS
+ symbolTable.push(); // ESSL3_BUILTINS
</ins><span class="cx">
</span><span class="cx"> TPublicType integer;
</span><span class="cx"> integer.type = EbtInt;
</span><del>- integer.size = 1;
- integer.matrix = false;
</del><ins>+ integer.primarySize = 1;
+ integer.secondarySize = 1;
</ins><span class="cx"> integer.array = false;
</span><span class="cx">
</span><span class="cx"> TPublicType floatingPoint;
</span><span class="cx"> floatingPoint.type = EbtFloat;
</span><del>- floatingPoint.size = 1;
- floatingPoint.matrix = false;
</del><ins>+ floatingPoint.primarySize = 1;
+ floatingPoint.secondarySize = 1;
</ins><span class="cx"> floatingPoint.array = false;
</span><span class="cx">
</span><span class="cx"> TPublicType sampler;
</span><del>- sampler.size = 1;
- sampler.matrix = false;
</del><ins>+ sampler.primarySize = 1;
+ sampler.secondarySize = 1;
</ins><span class="cx"> sampler.array = false;
</span><span class="cx">
</span><span class="cx"> switch(shaderType)
</span><span class="lines">@@ -329,6 +355,13 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool TCompiler::validateOutputs(TIntermNode* root)
+{
+ ValidateOutputs validateOutputs(infoSink.info, compileResources.MaxDrawBuffers);
+ root->traverse(&validateOutputs);
+ return (validateOutputs.numErrors() == 0);
+}
+
</ins><span class="cx"> void TCompiler::rewriteCSSShader(TIntermNode* root)
</span><span class="cx"> {
</span><span class="cx"> RenameFunction renamer("main(", "css_main(");
</span><span class="lines">@@ -356,14 +389,14 @@
</span><span class="cx">
</span><span class="cx"> // Output any errors first.
</span><span class="cx"> bool success = enforceFragmentShaderTimingRestrictions(graph);
</span><del>-
</del><ins>+
</ins><span class="cx"> // Then, output the dependency graph.
</span><span class="cx"> if (outputGraph)
</span><span class="cx"> {
</span><span class="cx"> TDependencyGraphOutput output(infoSink.info);
</span><span class="cx"> output.outputAllSpanningTrees(graph);
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return success;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -374,8 +407,15 @@
</span><span class="cx">
</span><span class="cx"> bool TCompiler::limitExpressionComplexity(TIntermNode* root)
</span><span class="cx"> {
</span><del>- TIntermTraverser traverser;
</del><ins>+ TMaxDepthTraverser traverser(maxExpressionComplexity+1);
</ins><span class="cx"> root->traverse(&traverser);
</span><ins>+
+ if (traverser.getMaxDepth() > maxExpressionComplexity)
+ {
+ infoSink.info << "Expression too complex.";
+ return false;
+ }
+
</ins><span class="cx"> TDependencyGraph graph(root);
</span><span class="cx">
</span><span class="cx"> for (TFunctionCallVector::const_iterator iter = graph.beginUserDefinedFunctionCalls();
</span><span class="lines">@@ -387,11 +427,6 @@
</span><span class="cx"> samplerSymbol->traverse(&graphTraverser);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (traverser.getMaxDepth() > maxExpressionComplexity)
- {
- infoSink.info << "Expression too complex.";
- return false;
- }
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -432,7 +467,6 @@
</span><span class="cx"> infoSink.info << "too many varyings";
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -454,38 +488,36 @@
</span><span class="cx"> const TVariableInfo& varying = varyings[ii];
</span><span class="cx"> if (varying.staticUse)
</span><span class="cx"> continue;
</span><del>- unsigned char size = 0;
- bool matrix = false;
</del><ins>+ unsigned char primarySize = 1, secondarySize = 1;
</ins><span class="cx"> switch (varying.type)
</span><span class="cx"> {
</span><span class="cx"> case SH_FLOAT:
</span><del>- size = 1;
</del><span class="cx"> break;
</span><span class="cx"> case SH_FLOAT_VEC2:
</span><del>- size = 2;
</del><ins>+ primarySize = 2;
</ins><span class="cx"> break;
</span><span class="cx"> case SH_FLOAT_VEC3:
</span><del>- size = 3;
</del><ins>+ primarySize = 3;
</ins><span class="cx"> break;
</span><span class="cx"> case SH_FLOAT_VEC4:
</span><del>- size = 4;
</del><ins>+ primarySize = 4;
</ins><span class="cx"> break;
</span><span class="cx"> case SH_FLOAT_MAT2:
</span><del>- size = 2;
- matrix = true;
</del><ins>+ primarySize = 2;
+ secondarySize = 2;
</ins><span class="cx"> break;
</span><span class="cx"> case SH_FLOAT_MAT3:
</span><del>- size = 3;
- matrix = true;
</del><ins>+ primarySize = 3;
+ secondarySize = 3;
</ins><span class="cx"> break;
</span><span class="cx"> case SH_FLOAT_MAT4:
</span><del>- size = 4;
- matrix = true;
</del><ins>+ primarySize = 4;
+ secondarySize = 4;
</ins><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="cx"> ASSERT(false);
</span><span class="cx"> }
</span><del>- TType type(EbtFloat, EbpUndefined, EvqVaryingOut, size, matrix, varying.isArray);
</del><ins>+ TType type(EbtFloat, EbpUndefined, EvqVaryingOut, primarySize, secondarySize, varying.isArray);
</ins><span class="cx"> TString name = varying.name.c_str();
</span><span class="cx"> if (varying.isArray)
</span><span class="cx"> {
</span><span class="lines">@@ -500,18 +532,6 @@
</span><span class="cx"> root->traverse(&initializer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TCompiler::mapLongVariableNames(TIntermNode* root)
-{
- ASSERT(longNameMap);
- MapLongVariableNames map(longNameMap);
- root->traverse(&map);
-}
-
-int TCompiler::getMappedNameMaxLength() const
-{
- return MAX_SHORTENED_IDENTIFIER_SIZE + 1;
-}
-
</del><span class="cx"> const TExtensionBehavior& TCompiler::getExtensionBehavior() const
</span><span class="cx"> {
</span><span class="cx"> return extensionBehavior;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorConstantUnionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ConstantUnion.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ConstantUnion.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ConstantUnion.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -19,13 +19,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void setIConst(int i) {iConst = i; type = EbtInt; }
</span><ins>+ void setUConst(unsigned int u) { uConst = u; type = EbtUInt; }
</ins><span class="cx"> void setFConst(float f) {fConst = f; type = EbtFloat; }
</span><span class="cx"> void setBConst(bool b) {bConst = b; type = EbtBool; }
</span><span class="cx">
</span><del>- int getIConst() { return iConst; }
- float getFConst() { return fConst; }
- bool getBConst() { return bConst; }
</del><span class="cx"> int getIConst() const { return iConst; }
</span><ins>+ unsigned int getUConst() const { return uConst; }
</ins><span class="cx"> float getFConst() const { return fConst; }
</span><span class="cx"> bool getBConst() const { return bConst; }
</span><span class="cx">
</span><span class="lines">@@ -34,6 +33,11 @@
</span><span class="cx"> return i == iConst;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ bool operator==(const unsigned int u) const
+ {
+ return u == uConst;
+ }
+
</ins><span class="cx"> bool operator==(const float f) const
</span><span class="cx"> {
</span><span class="cx"> return f == fConst;
</span><span class="lines">@@ -52,6 +56,8 @@
</span><span class="cx"> switch (type) {
</span><span class="cx"> case EbtInt:
</span><span class="cx"> return constant.iConst == iConst;
</span><ins>+ case EbtUInt:
+ return constant.uConst == uConst;
</ins><span class="cx"> case EbtFloat:
</span><span class="cx"> return constant.fConst == fConst;
</span><span class="cx"> case EbtBool:
</span><span class="lines">@@ -66,6 +72,11 @@
</span><span class="cx"> return !operator==(i);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ bool operator!=(const unsigned int u) const
+ {
+ return !operator==(u);
+ }
+
</ins><span class="cx"> bool operator!=(const float f) const
</span><span class="cx"> {
</span><span class="cx"> return !operator==(f);
</span><span class="lines">@@ -87,6 +98,8 @@
</span><span class="cx"> switch (type) {
</span><span class="cx"> case EbtInt:
</span><span class="cx"> return iConst > constant.iConst;
</span><ins>+ case EbtUInt:
+ return uConst > constant.uConst;
</ins><span class="cx"> case EbtFloat:
</span><span class="cx"> return fConst > constant.fConst;
</span><span class="cx"> default:
</span><span class="lines">@@ -100,6 +113,8 @@
</span><span class="cx"> switch (type) {
</span><span class="cx"> case EbtInt:
</span><span class="cx"> return iConst < constant.iConst;
</span><ins>+ case EbtUInt:
+ return uConst < constant.uConst;
</ins><span class="cx"> case EbtFloat:
</span><span class="cx"> return fConst < constant.fConst;
</span><span class="cx"> default:
</span><span class="lines">@@ -113,6 +128,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst + constant.uConst); break;
</ins><span class="cx"> case EbtFloat: returnValue.setFConst(fConst + constant.fConst); break;
</span><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="lines">@@ -126,6 +142,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst - constant.uConst); break;
</ins><span class="cx"> case EbtFloat: returnValue.setFConst(fConst - constant.fConst); break;
</span><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="lines">@@ -139,6 +156,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst * constant.uConst); break;
</ins><span class="cx"> case EbtFloat: returnValue.setFConst(fConst * constant.fConst); break;
</span><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="lines">@@ -152,6 +170,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst % constant.uConst); break;
</ins><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -164,6 +183,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst >> constant.uConst); break;
</ins><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -176,6 +196,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst << constant.uConst); break;
</ins><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -188,6 +209,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst & constant.uConst); break;
</ins><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -200,6 +222,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst | constant.uConst); break;
</ins><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -212,6 +235,7 @@
</span><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><ins>+ case EbtUInt: returnValue.setUConst(uConst ^ constant.uConst); break;
</ins><span class="cx"> default: assert(false && "Default missing");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -247,6 +271,7 @@
</span><span class="cx">
</span><span class="cx"> union {
</span><span class="cx"> int iConst; // used for ivec, scalar ints
</span><ins>+ unsigned int uConst; // used for uvec, scalar uints
</ins><span class="cx"> bool bConst; // used for bvec, scalar bools
</span><span class="cx"> float fConst; // used for vec, mat, scalar floats
</span><span class="cx"> } ;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDetectCallDepthh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,8 +7,6 @@
</span><span class="cx"> #ifndef COMPILER_DETECT_RECURSION_H_
</span><span class="cx"> #define COMPILER_DETECT_RECURSION_H_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
-
</del><span class="cx"> #include <limits.h>
</span><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx"> #include "compiler/translator/VariableInfo.h"
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDiagnosticscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDiagnosticsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDirectiveHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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">@@ -26,9 +26,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TDirectiveHandler::TDirectiveHandler(TExtensionBehavior& extBehavior,
</span><del>- TDiagnostics& diagnostics)
</del><ins>+ TDiagnostics& diagnostics,
+ int& shaderVersion)
</ins><span class="cx"> : mExtensionBehavior(extBehavior),
</span><del>- mDiagnostics(diagnostics)
</del><ins>+ mDiagnostics(diagnostics),
+ mShaderVersion(shaderVersion)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -148,10 +150,13 @@
</span><span class="cx"> void TDirectiveHandler::handleVersion(const pp::SourceLocation& loc,
</span><span class="cx"> int version)
</span><span class="cx"> {
</span><del>- static const int kVersion = 100;
-
- if (version != kVersion)
</del><ins>+ if (version == 100 ||
+ version == 300)
</ins><span class="cx"> {
</span><ins>+ mShaderVersion = version;
+ }
+ else
+ {
</ins><span class="cx"> std::stringstream stream;
</span><span class="cx"> stream << version;
</span><span class="cx"> std::string str = stream.str();
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDirectiveHandlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -17,7 +17,8 @@
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx"> TDirectiveHandler(TExtensionBehavior& extBehavior,
</span><del>- TDiagnostics& diagnostics);
</del><ins>+ TDiagnostics& diagnostics,
+ int& shaderVersion);
</ins><span class="cx"> virtual ~TDirectiveHandler();
</span><span class="cx">
</span><span class="cx"> const TPragma& pragma() const { return mPragma; }
</span><span class="lines">@@ -41,6 +42,7 @@
</span><span class="cx"> TPragma mPragma;
</span><span class="cx"> TExtensionBehavior& mExtensionBehavior;
</span><span class="cx"> TDiagnostics& mDiagnostics;
</span><ins>+ int& mShaderVersion;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // COMPILER_DIRECTIVE_HANDLER_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorFlagStd140Structscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,77 @@
</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 "compiler/translator/FlagStd140Structs.h"
+
+namespace sh
+{
+
+bool FlagStd140Structs::visitBinary(Visit visit, TIntermBinary *binaryNode)
+{
+ if (binaryNode->getRight()->getBasicType() == EbtStruct)
+ {
+ switch (binaryNode->getOp())
+ {
+ case EOpIndexDirectInterfaceBlock:
+ case EOpIndexDirectStruct:
+ if (isInStd140InterfaceBlock(binaryNode->getLeft()))
+ {
+ mFlaggedNodes.push_back(binaryNode);
+ }
+ break;
+
+ default: break;
+ }
+ return false;
+ }
+
+ if (binaryNode->getOp() == EOpIndexDirectStruct)
+ {
+ return false;
+ }
+
+ return visit == PreVisit;
+}
+
+void FlagStd140Structs::visitSymbol(TIntermSymbol *symbol)
+{
+ if (isInStd140InterfaceBlock(symbol) && symbol->getBasicType() == EbtStruct)
+ {
+ mFlaggedNodes.push_back(symbol);
+ }
+}
+
+bool FlagStd140Structs::isInStd140InterfaceBlock(TIntermTyped *node) const
+{
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+
+ if (binaryNode)
+ {
+ return isInStd140InterfaceBlock(binaryNode->getLeft());
+ }
+
+ const TType &type = node->getType();
+
+ // determine if we are in the standard layout
+ const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
+ if (interfaceBlock)
+ {
+ return (interfaceBlock->blockStorage() == EbsStd140);
+ }
+
+ return false;
+}
+
+std::vector<TIntermTyped *> FlagStd140ValueStructs(TIntermNode *node)
+{
+ FlagStd140Structs flaggingTraversal;
+
+ node->traverse(&flaggingTraversal);
+
+ return flaggingTraversal.getFlaggedNodes();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorFlagStd140Structsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,37 @@
</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.
+//
+
+#ifndef COMPILER_FLAGSTD140STRUCTS_H_
+#define COMPILER_FLAGSTD140STRUCTS_H_
+
+#include "compiler/translator/intermediate.h"
+
+namespace sh
+{
+
+// This class finds references to nested structs of std140 blocks that access
+// the nested struct "by value", where the padding added in the translator
+// conflicts with the "natural" unpadded type.
+class FlagStd140Structs : public TIntermTraverser
+{
+ public:
+ const std::vector<TIntermTyped *> getFlaggedNodes() const { return mFlaggedNodes; }
+
+ protected:
+ virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
+ virtual void visitSymbol(TIntermSymbol *symbol);
+
+ private:
+ bool isInStd140InterfaceBlock(TIntermTyped *node) const;
+
+ std::vector<TIntermTyped *> mFlaggedNodes;
+};
+
+std::vector<TIntermTyped *> FlagStd140ValueStructs(TIntermNode *node);
+
+}
+
+#endif // COMPILER_FLAGSTD140STRUCTS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorForLoopUnrollcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -6,210 +6,77 @@
</span><span class="cx">
</span><span class="cx"> #include "compiler/translator/ForLoopUnroll.h"
</span><span class="cx">
</span><del>-namespace {
-
-class IntegerForLoopUnrollMarker : public TIntermTraverser {
-public:
-
- virtual bool visitLoop(Visit, TIntermLoop* node)
- {
- // This is called after ValidateLimitations pass, so all the ASSERT
- // should never fail.
- // See ValidateLimitations::validateForLoopInit().
- ASSERT(node);
- ASSERT(node->getType() == ELoopFor);
- ASSERT(node->getInit());
- TIntermAggregate* decl = node->getInit()->getAsAggregate();
- ASSERT(decl && decl->getOp() == EOpDeclaration);
- TIntermSequence& declSeq = decl->getSequence();
- ASSERT(declSeq.size() == 1);
- TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
- ASSERT(declInit && declInit->getOp() == EOpInitialize);
- ASSERT(declInit->getLeft());
- TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
- ASSERT(symbol);
- TBasicType type = symbol->getBasicType();
- ASSERT(type == EbtInt || type == EbtFloat);
- if (type == EbtInt)
- node->setUnrollFlag(true);
</del><ins>+bool ForLoopUnrollMarker::visitBinary(Visit, TIntermBinary *node)
+{
+ if (mUnrollCondition != kSamplerArrayIndex)
</ins><span class="cx"> return true;
</span><del>- }
</del><span class="cx">
</span><del>-};
-
-} // anonymous namepsace
-
-void ForLoopUnroll::FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info)
-{
- ASSERT(node->getType() == ELoopFor);
- ASSERT(node->getUnrollFlag());
-
- TIntermNode* init = node->getInit();
- ASSERT(init != NULL);
- TIntermAggregate* decl = init->getAsAggregate();
- ASSERT((decl != NULL) && (decl->getOp() == EOpDeclaration));
- TIntermSequence& declSeq = decl->getSequence();
- ASSERT(declSeq.size() == 1);
- TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
- ASSERT((declInit != NULL) && (declInit->getOp() == EOpInitialize));
- TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
- ASSERT(symbol != NULL);
- ASSERT(symbol->getBasicType() == EbtInt);
-
- info.id = symbol->getId();
-
- ASSERT(declInit->getRight() != NULL);
- TIntermConstantUnion* initNode = declInit->getRight()->getAsConstantUnion();
- ASSERT(initNode != NULL);
-
- info.initValue = evaluateIntConstant(initNode);
- info.currentValue = info.initValue;
-
- TIntermNode* cond = node->getCondition();
- ASSERT(cond != NULL);
- TIntermBinary* binOp = cond->getAsBinaryNode();
- ASSERT(binOp != NULL);
- ASSERT(binOp->getRight() != NULL);
- ASSERT(binOp->getRight()->getAsConstantUnion() != NULL);
-
- info.incrementValue = getLoopIncrement(node);
- info.stopValue = evaluateIntConstant(
- binOp->getRight()->getAsConstantUnion());
- info.op = binOp->getOp();
-}
-
-void ForLoopUnroll::Step()
-{
- ASSERT(mLoopIndexStack.size() > 0);
- TLoopIndexInfo& info = mLoopIndexStack[mLoopIndexStack.size() - 1];
- info.currentValue += info.incrementValue;
-}
-
-bool ForLoopUnroll::SatisfiesLoopCondition()
-{
- ASSERT(mLoopIndexStack.size() > 0);
- TLoopIndexInfo& info = mLoopIndexStack[mLoopIndexStack.size() - 1];
- // Relational operator is one of: > >= < <= == or !=.
- switch (info.op) {
- case EOpEqual:
- return (info.currentValue == info.stopValue);
- case EOpNotEqual:
- return (info.currentValue != info.stopValue);
- case EOpLessThan:
- return (info.currentValue < info.stopValue);
- case EOpGreaterThan:
- return (info.currentValue > info.stopValue);
- case EOpLessThanEqual:
- return (info.currentValue <= info.stopValue);
- case EOpGreaterThanEqual:
- return (info.currentValue >= info.stopValue);
</del><ins>+ // If a sampler array index is also the loop index,
+ // 1) if the index type is integer, mark the loop for unrolling;
+ // 2) if the index type if float, set a flag to later fail compile.
+ switch (node->getOp())
+ {
+ case EOpIndexIndirect:
+ if (node->getLeft() != NULL && node->getRight() != NULL && node->getLeft()->getAsSymbolNode())
+ {
+ TIntermSymbol *symbol = node->getLeft()->getAsSymbolNode();
+ if (IsSampler(symbol->getBasicType()) && symbol->isArray() && !mLoopStack.empty())
+ {
+ mVisitSamplerArrayIndexNodeInsideLoop = true;
+ node->getRight()->traverse(this);
+ mVisitSamplerArrayIndexNodeInsideLoop = false;
+ // We have already visited all the children.
+ return false;
+ }
+ }
+ break;
</ins><span class="cx"> default:
</span><del>- UNREACHABLE();
</del><ins>+ break;
</ins><span class="cx"> }
</span><del>- return false;
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ForLoopUnroll::NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol)
</del><ins>+bool ForLoopUnrollMarker::visitLoop(Visit, TIntermLoop *node)
</ins><span class="cx"> {
</span><del>- for (TVector<TLoopIndexInfo>::iterator i = mLoopIndexStack.begin();
- i != mLoopIndexStack.end();
- ++i) {
- if (i->id == symbol->getId())
- return true;
</del><ins>+ if (mUnrollCondition == kIntegerIndex)
+ {
+ // Check if loop index type is integer.
+ // This is called after ValidateLimitations pass, so all the calls
+ // should be valid. See ValidateLimitations::validateForLoopInit().
+ TIntermSequence& declSeq = node->getInit()->getAsAggregate()->getSequence();
+ TIntermSymbol* symbol = declSeq[0]->getAsBinaryNode()->getLeft()->getAsSymbolNode();
+ if (symbol->getBasicType() == EbtInt)
+ node->setUnrollFlag(true);
</ins><span class="cx"> }
</span><del>- return false;
-}
</del><span class="cx">
</span><del>-int ForLoopUnroll::GetLoopIndexValue(TIntermSymbol* symbol)
-{
- for (TVector<TLoopIndexInfo>::iterator i = mLoopIndexStack.begin();
- i != mLoopIndexStack.end();
- ++i) {
- if (i->id == symbol->getId())
- return i->currentValue;
</del><ins>+ TIntermNode *body = node->getBody();
+ if (body != NULL)
+ {
+ mLoopStack.push(node);
+ body->traverse(this);
+ mLoopStack.pop();
</ins><span class="cx"> }
</span><del>- UNREACHABLE();
</del><ins>+ // The loop is fully processed - no need to visit children.
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ForLoopUnroll::Push(TLoopIndexInfo& info)
</del><ins>+void ForLoopUnrollMarker::visitSymbol(TIntermSymbol* symbol)
</ins><span class="cx"> {
</span><del>- mLoopIndexStack.push_back(info);
-}
-
-void ForLoopUnroll::Pop()
-{
- mLoopIndexStack.pop_back();
-}
-
-// static
-void ForLoopUnroll::MarkForLoopsWithIntegerIndicesForUnrolling(
- TIntermNode* root)
-{
- ASSERT(root);
-
- IntegerForLoopUnrollMarker marker;
- root->traverse(&marker);
-}
-
-int ForLoopUnroll::getLoopIncrement(TIntermLoop* node)
-{
- TIntermNode* expr = node->getExpression();
- ASSERT(expr != NULL);
- // for expression has one of the following forms:
- // loop_index++
- // loop_index--
- // loop_index += constant_expression
- // loop_index -= constant_expression
- // ++loop_index
- // --loop_index
- // The last two forms are not specified in the spec, but I am assuming
- // its an oversight.
- TIntermUnary* unOp = expr->getAsUnaryNode();
- TIntermBinary* binOp = unOp ? NULL : expr->getAsBinaryNode();
-
- TOperator op = EOpNull;
- TIntermConstantUnion* incrementNode = NULL;
- if (unOp != NULL) {
- op = unOp->getOp();
- } else if (binOp != NULL) {
- op = binOp->getOp();
- ASSERT(binOp->getRight() != NULL);
- incrementNode = binOp->getRight()->getAsConstantUnion();
- ASSERT(incrementNode != NULL);
- }
-
- int increment = 0;
- // The operator is one of: ++ -- += -=.
- switch (op) {
- case EOpPostIncrement:
- case EOpPreIncrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
- increment = 1;
</del><ins>+ if (!mVisitSamplerArrayIndexNodeInsideLoop)
+ return;
+ TIntermLoop *loop = mLoopStack.findLoop(symbol);
+ if (loop)
+ {
+ switch (symbol->getBasicType())
+ {
+ case EbtFloat:
+ mSamplerArrayIndexIsFloatLoopIndex = true;
</ins><span class="cx"> break;
</span><del>- case EOpPostDecrement:
- case EOpPreDecrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
- increment = -1;
</del><ins>+ case EbtInt:
+ loop->setUnrollFlag(true);
</ins><span class="cx"> break;
</span><del>- case EOpAddAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
- increment = evaluateIntConstant(incrementNode);
- break;
- case EOpSubAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
- increment = - evaluateIntConstant(incrementNode);
- break;
- default:
- ASSERT(false);
</del><ins>+ default:
+ UNREACHABLE();
+ }
</ins><span class="cx"> }
</span><del>-
- return increment;
</del><span class="cx"> }
</span><del>-
-int ForLoopUnroll::evaluateIntConstant(TIntermConstantUnion* node)
-{
- ASSERT((node != NULL) && (node->getUnionArrayPointer() != NULL));
- return node->getIConst(0);
-}
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorForLoopUnrollh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,46 +7,44 @@
</span><span class="cx"> #ifndef COMPILER_FORLOOPUNROLL_H_
</span><span class="cx"> #define COMPILER_FORLOOPUNROLL_H_
</span><span class="cx">
</span><del>-#include "compiler/translator/intermediate.h"
</del><ins>+#include "compiler/translator/LoopInfo.h"
</ins><span class="cx">
</span><del>-struct TLoopIndexInfo {
- int id;
- int initValue;
- int stopValue;
- int incrementValue;
- TOperator op;
- int currentValue;
-};
</del><ins>+// This class detects for-loops that needs to be unrolled.
+// Currently we support two unroll conditions:
+// 1) kForLoopWithIntegerIndex: unroll if the index type is integer.
+// 2) kForLoopWithSamplerArrayIndex: unroll where a sampler array index
+// is also the loop integer index, and reject and fail a compile
+// where a sampler array index is also the loop float index.
+class ForLoopUnrollMarker : public TIntermTraverser
+{
+ public:
+ enum UnrollCondition
+ {
+ kIntegerIndex,
+ kSamplerArrayIndex
+ };
</ins><span class="cx">
</span><del>-class ForLoopUnroll {
-public:
- ForLoopUnroll() { }
</del><ins>+ ForLoopUnrollMarker(UnrollCondition condition)
+ : mUnrollCondition(condition),
+ mSamplerArrayIndexIsFloatLoopIndex(false),
+ mVisitSamplerArrayIndexNodeInsideLoop(false)
+ {
+ }
</ins><span class="cx">
</span><del>- void FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info);
</del><ins>+ virtual bool visitBinary(Visit, TIntermBinary *node);
+ virtual bool visitLoop(Visit, TIntermLoop *node);
+ virtual void visitSymbol(TIntermSymbol *node);
</ins><span class="cx">
</span><del>- // Update the info.currentValue for the next loop iteration.
- void Step();
</del><ins>+ bool samplerArrayIndexIsFloatLoopIndex() const
+ {
+ return mSamplerArrayIndexIsFloatLoopIndex;
+ }
</ins><span class="cx">
</span><del>- // Return false if loop condition is no longer satisfied.
- bool SatisfiesLoopCondition();
-
- // Check if the symbol is the index of a loop that's unrolled.
- bool NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol);
-
- // Return the current value of a given loop index symbol.
- int GetLoopIndexValue(TIntermSymbol* symbol);
-
- void Push(TLoopIndexInfo& info);
- void Pop();
-
- static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode* root);
-
-private:
- int getLoopIncrement(TIntermLoop* node);
-
- int evaluateIntConstant(TIntermConstantUnion* node);
-
- TVector<TLoopIndexInfo> mLoopIndexStack;
</del><ins>+ private:
+ UnrollCondition mUnrollCondition;
+ TLoopStack mLoopStack;
+ bool mSamplerArrayIndexIsFloatLoopIndex;
+ bool mVisitSamplerArrayIndexNodeInsideLoop;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorHashNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/HashNames.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/HashNames.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/HashNames.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,7 +10,6 @@
</span><span class="cx"> #include <map>
</span><span class="cx">
</span><span class="cx"> #include "compiler/translator/intermediate.h"
</span><del>-#include "GLSLANG/ShaderLang.h"
</del><span class="cx">
</span><span class="cx"> #define HASHED_NAME_PREFIX "webgl_"
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,11 +1,11 @@
</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"> //
</span><del>-// Create strings that declare built-in definitions, add built-ins that
</del><ins>+// Create symbols that declare built-in definitions, add built-ins that
</ins><span class="cx"> // cannot be expressed in the files, and establish mappings between
</span><span class="cx"> // built-in functions and operators.
</span><span class="cx"> //
</span><span class="lines">@@ -16,406 +16,582 @@
</span><span class="cx">
</span><span class="cx"> void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
</span><span class="cx"> {
</span><del>- TType *float1 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 1);
- TType *float2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2);
- TType *float3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3);
- TType *float4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4);
</del><ins>+ TType *float1 = new TType(EbtFloat);
+ TType *float2 = new TType(EbtFloat, 2);
+ TType *float3 = new TType(EbtFloat, 3);
+ TType *float4 = new TType(EbtFloat, 4);
</ins><span class="cx">
</span><del>- TType *int2 = new TType(EbtInt, EbpUndefined, EvqGlobal, 2);
- TType *int3 = new TType(EbtInt, EbpUndefined, EvqGlobal, 3);
- TType *int4 = new TType(EbtInt, EbpUndefined, EvqGlobal, 4);
</del><ins>+ TType *int1 = new TType(EbtInt);
+ TType *int2 = new TType(EbtInt, 2);
+ TType *int3 = new TType(EbtInt, 3);
+ TType *int4 = new TType(EbtInt, 4);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Angle and Trigonometric Functions.
</span><span class="cx"> //
</span><del>- symbolTable.insertBuiltIn(float1, "radians", float1);
- symbolTable.insertBuiltIn(float2, "radians", float2);
- symbolTable.insertBuiltIn(float3, "radians", float3);
- symbolTable.insertBuiltIn(float4, "radians", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "radians", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "radians", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "radians", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "radians", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "degrees", float1);
- symbolTable.insertBuiltIn(float2, "degrees", float2);
- symbolTable.insertBuiltIn(float3, "degrees", float3);
- symbolTable.insertBuiltIn(float4, "degrees", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "degrees", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "degrees", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "degrees", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "degrees", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "sin", float1);
- symbolTable.insertBuiltIn(float2, "sin", float2);
- symbolTable.insertBuiltIn(float3, "sin", float3);
- symbolTable.insertBuiltIn(float4, "sin", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sin", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sin", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sin", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sin", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "cos", float1);
- symbolTable.insertBuiltIn(float2, "cos", float2);
- symbolTable.insertBuiltIn(float3, "cos", float3);
- symbolTable.insertBuiltIn(float4, "cos", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "cos", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "cos", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "cos", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "cos", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "tan", float1);
- symbolTable.insertBuiltIn(float2, "tan", float2);
- symbolTable.insertBuiltIn(float3, "tan", float3);
- symbolTable.insertBuiltIn(float4, "tan", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "tan", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "tan", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "tan", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "tan", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "asin", float1);
- symbolTable.insertBuiltIn(float2, "asin", float2);
- symbolTable.insertBuiltIn(float3, "asin", float3);
- symbolTable.insertBuiltIn(float4, "asin", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "asin", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "asin", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "asin", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "asin", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "acos", float1);
- symbolTable.insertBuiltIn(float2, "acos", float2);
- symbolTable.insertBuiltIn(float3, "acos", float3);
- symbolTable.insertBuiltIn(float4, "acos", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "acos", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "acos", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "acos", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "acos", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "atan", float1, float1);
- symbolTable.insertBuiltIn(float2, "atan", float2, float2);
- symbolTable.insertBuiltIn(float3, "atan", float3, float3);
- symbolTable.insertBuiltIn(float4, "atan", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "atan", float1);
- symbolTable.insertBuiltIn(float2, "atan", float2);
- symbolTable.insertBuiltIn(float3, "atan", float3);
- symbolTable.insertBuiltIn(float4, "atan", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Exponential Functions.
</span><span class="cx"> //
</span><del>- symbolTable.insertBuiltIn(float1, "pow", float1, float1);
- symbolTable.insertBuiltIn(float2, "pow", float2, float2);
- symbolTable.insertBuiltIn(float3, "pow", float3, float3);
- symbolTable.insertBuiltIn(float4, "pow", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "pow", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "pow", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "pow", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "pow", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "exp", float1);
- symbolTable.insertBuiltIn(float2, "exp", float2);
- symbolTable.insertBuiltIn(float3, "exp", float3);
- symbolTable.insertBuiltIn(float4, "exp", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "log", float1);
- symbolTable.insertBuiltIn(float2, "log", float2);
- symbolTable.insertBuiltIn(float3, "log", float3);
- symbolTable.insertBuiltIn(float4, "log", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "exp2", float1);
- symbolTable.insertBuiltIn(float2, "exp2", float2);
- symbolTable.insertBuiltIn(float3, "exp2", float3);
- symbolTable.insertBuiltIn(float4, "exp2", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp2", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp2", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp2", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp2", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "log2", float1);
- symbolTable.insertBuiltIn(float2, "log2", float2);
- symbolTable.insertBuiltIn(float3, "log2", float3);
- symbolTable.insertBuiltIn(float4, "log2", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log2", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log2", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log2", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log2", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "sqrt", float1);
- symbolTable.insertBuiltIn(float2, "sqrt", float2);
- symbolTable.insertBuiltIn(float3, "sqrt", float3);
- symbolTable.insertBuiltIn(float4, "sqrt", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sqrt", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sqrt", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sqrt", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sqrt", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "inversesqrt", float1);
- symbolTable.insertBuiltIn(float2, "inversesqrt", float2);
- symbolTable.insertBuiltIn(float3, "inversesqrt", float3);
- symbolTable.insertBuiltIn(float4, "inversesqrt", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "inversesqrt", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "inversesqrt", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "inversesqrt", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "inversesqrt", float4);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Common Functions.
</span><span class="cx"> //
</span><del>- symbolTable.insertBuiltIn(float1, "abs", float1);
- symbolTable.insertBuiltIn(float2, "abs", float2);
- symbolTable.insertBuiltIn(float3, "abs", float3);
- symbolTable.insertBuiltIn(float4, "abs", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "abs", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "abs", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "abs", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "abs", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "sign", float1);
- symbolTable.insertBuiltIn(float2, "sign", float2);
- symbolTable.insertBuiltIn(float3, "sign", float3);
- symbolTable.insertBuiltIn(float4, "sign", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sign", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sign", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sign", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sign", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "floor", float1);
- symbolTable.insertBuiltIn(float2, "floor", float2);
- symbolTable.insertBuiltIn(float3, "floor", float3);
- symbolTable.insertBuiltIn(float4, "floor", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "floor", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "floor", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "floor", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "floor", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "ceil", float1);
- symbolTable.insertBuiltIn(float2, "ceil", float2);
- symbolTable.insertBuiltIn(float3, "ceil", float3);
- symbolTable.insertBuiltIn(float4, "ceil", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "ceil", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "ceil", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "ceil", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "ceil", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "fract", float1);
- symbolTable.insertBuiltIn(float2, "fract", float2);
- symbolTable.insertBuiltIn(float3, "fract", float3);
- symbolTable.insertBuiltIn(float4, "fract", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "fract", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "fract", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "fract", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "fract", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "mod", float1, float1);
- symbolTable.insertBuiltIn(float2, "mod", float2, float1);
- symbolTable.insertBuiltIn(float3, "mod", float3, float1);
- symbolTable.insertBuiltIn(float4, "mod", float4, float1);
- symbolTable.insertBuiltIn(float2, "mod", float2, float2);
- symbolTable.insertBuiltIn(float3, "mod", float3, float3);
- symbolTable.insertBuiltIn(float4, "mod", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "mod", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mod", float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mod", float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mod", float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mod", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mod", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mod", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "min", float1, float1);
- symbolTable.insertBuiltIn(float2, "min", float2, float1);
- symbolTable.insertBuiltIn(float3, "min", float3, float1);
- symbolTable.insertBuiltIn(float4, "min", float4, float1);
- symbolTable.insertBuiltIn(float2, "min", float2, float2);
- symbolTable.insertBuiltIn(float3, "min", float3, float3);
- symbolTable.insertBuiltIn(float4, "min", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "min", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "min", float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "min", float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "min", float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "min", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "min", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "min", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "max", float1, float1);
- symbolTable.insertBuiltIn(float2, "max", float2, float1);
- symbolTable.insertBuiltIn(float3, "max", float3, float1);
- symbolTable.insertBuiltIn(float4, "max", float4, float1);
- symbolTable.insertBuiltIn(float2, "max", float2, float2);
- symbolTable.insertBuiltIn(float3, "max", float3, float3);
- symbolTable.insertBuiltIn(float4, "max", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "max", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "max", float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "max", float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "max", float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "max", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "max", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "max", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "clamp", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "clamp", float2, float1, float1);
- symbolTable.insertBuiltIn(float3, "clamp", float3, float1, float1);
- symbolTable.insertBuiltIn(float4, "clamp", float4, float1, float1);
- symbolTable.insertBuiltIn(float2, "clamp", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "clamp", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "clamp", float4, float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "clamp", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "clamp", float2, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "clamp", float3, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "clamp", float4, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "clamp", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "clamp", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "clamp", float4, float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "mix", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "mix", float2, float2, float1);
- symbolTable.insertBuiltIn(float3, "mix", float3, float3, float1);
- symbolTable.insertBuiltIn(float4, "mix", float4, float4, float1);
- symbolTable.insertBuiltIn(float2, "mix", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "mix", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "mix", float4, float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "mix", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mix", float2, float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mix", float3, float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mix", float4, float4, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mix", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mix", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mix", float4, float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "step", float1, float1);
- symbolTable.insertBuiltIn(float2, "step", float2, float2);
- symbolTable.insertBuiltIn(float3, "step", float3, float3);
- symbolTable.insertBuiltIn(float4, "step", float4, float4);
- symbolTable.insertBuiltIn(float2, "step", float1, float2);
- symbolTable.insertBuiltIn(float3, "step", float1, float3);
- symbolTable.insertBuiltIn(float4, "step", float1, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "step", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "step", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "step", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "step", float4, float4);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "step", float1, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "step", float1, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "step", float1, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "smoothstep", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "smoothstep", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "smoothstep", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "smoothstep", float4, float4, float4);
- symbolTable.insertBuiltIn(float2, "smoothstep", float1, float1, float2);
- symbolTable.insertBuiltIn(float3, "smoothstep", float1, float1, float3);
- symbolTable.insertBuiltIn(float4, "smoothstep", float1, float1, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "smoothstep", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "smoothstep", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "smoothstep", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "smoothstep", float4, float4, float4);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "smoothstep", float1, float1, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "smoothstep", float1, float1, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "smoothstep", float1, float1, float4);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Geometric Functions.
</span><span class="cx"> //
</span><del>- symbolTable.insertBuiltIn(float1, "length", float1);
- symbolTable.insertBuiltIn(float1, "length", float2);
- symbolTable.insertBuiltIn(float1, "length", float3);
- symbolTable.insertBuiltIn(float1, "length", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "distance", float1, float1);
- symbolTable.insertBuiltIn(float1, "distance", float2, float2);
- symbolTable.insertBuiltIn(float1, "distance", float3, float3);
- symbolTable.insertBuiltIn(float1, "distance", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "dot", float1, float1);
- symbolTable.insertBuiltIn(float1, "dot", float2, float2);
- symbolTable.insertBuiltIn(float1, "dot", float3, float3);
- symbolTable.insertBuiltIn(float1, "dot", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float3, "cross", float3, float3);
- symbolTable.insertBuiltIn(float1, "normalize", float1);
- symbolTable.insertBuiltIn(float2, "normalize", float2);
- symbolTable.insertBuiltIn(float3, "normalize", float3);
- symbolTable.insertBuiltIn(float4, "normalize", float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "cross", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "normalize", float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "normalize", float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "normalize", float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "normalize", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "faceforward", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "faceforward", float2, float2, float2);
- symbolTable.insertBuiltIn(float3, "faceforward", float3, float3, float3);
- symbolTable.insertBuiltIn(float4, "faceforward", float4, float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "faceforward", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "faceforward", float2, float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "faceforward", float3, float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "faceforward", float4, float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "reflect", float1, float1);
- symbolTable.insertBuiltIn(float2, "reflect", float2, float2);
- symbolTable.insertBuiltIn(float3, "reflect", float3, float3);
- symbolTable.insertBuiltIn(float4, "reflect", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "reflect", float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "reflect", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "reflect", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "reflect", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "refract", float1, float1, float1);
- symbolTable.insertBuiltIn(float2, "refract", float2, float2, float1);
- symbolTable.insertBuiltIn(float3, "refract", float3, float3, float1);
- symbolTable.insertBuiltIn(float4, "refract", float4, float4, float1);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "refract", float1, float1, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "refract", float2, float2, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "refract", float3, float3, float1);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "refract", float4, float4, float1);
</ins><span class="cx">
</span><del>- TType *mat2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2, true);
- TType *mat3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3, true);
- TType *mat4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4, true);
</del><ins>+ TType *mat2 = new TType(EbtFloat, 2, 2);
+ TType *mat3 = new TType(EbtFloat, 3, 3);
+ TType *mat4 = new TType(EbtFloat, 4, 4);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Matrix Functions.
</span><span class="cx"> //
</span><del>- symbolTable.insertBuiltIn(mat2, "matrixCompMult", mat2, mat2);
- symbolTable.insertBuiltIn(mat3, "matrixCompMult", mat3, mat3);
- symbolTable.insertBuiltIn(mat4, "matrixCompMult", mat4, mat4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, mat2, "matrixCompMult", mat2, mat2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, mat3, "matrixCompMult", mat3, mat3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, mat4, "matrixCompMult", mat4, mat4);
</ins><span class="cx">
</span><del>- TType *bool1 = new TType(EbtBool, EbpUndefined, EvqGlobal, 1);
- TType *bool2 = new TType(EbtBool, EbpUndefined, EvqGlobal, 2);
- TType *bool3 = new TType(EbtBool, EbpUndefined, EvqGlobal, 3);
- TType *bool4 = new TType(EbtBool, EbpUndefined, EvqGlobal, 4);
</del><ins>+ TType *bool1 = new TType(EbtBool);
+ TType *bool2 = new TType(EbtBool, 2);
+ TType *bool3 = new TType(EbtBool, 3);
+ TType *bool4 = new TType(EbtBool, 4);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Vector relational functions.
</span><span class="cx"> //
</span><del>- symbolTable.insertBuiltIn(bool2, "lessThan", float2, float2);
- symbolTable.insertBuiltIn(bool3, "lessThan", float3, float3);
- symbolTable.insertBuiltIn(bool4, "lessThan", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThan", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThan", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThan", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "lessThan", int2, int2);
- symbolTable.insertBuiltIn(bool3, "lessThan", int3, int3);
- symbolTable.insertBuiltIn(bool4, "lessThan", int4, int4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThan", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThan", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThan", int4, int4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "lessThanEqual", float2, float2);
- symbolTable.insertBuiltIn(bool3, "lessThanEqual", float3, float3);
- symbolTable.insertBuiltIn(bool4, "lessThanEqual", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThanEqual", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThanEqual", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThanEqual", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "lessThanEqual", int2, int2);
- symbolTable.insertBuiltIn(bool3, "lessThanEqual", int3, int3);
- symbolTable.insertBuiltIn(bool4, "lessThanEqual", int4, int4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThanEqual", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThanEqual", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThanEqual", int4, int4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "greaterThan", float2, float2);
- symbolTable.insertBuiltIn(bool3, "greaterThan", float3, float3);
- symbolTable.insertBuiltIn(bool4, "greaterThan", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThan", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThan", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThan", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "greaterThan", int2, int2);
- symbolTable.insertBuiltIn(bool3, "greaterThan", int3, int3);
- symbolTable.insertBuiltIn(bool4, "greaterThan", int4, int4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThan", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThan", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThan", int4, int4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "greaterThanEqual", float2, float2);
- symbolTable.insertBuiltIn(bool3, "greaterThanEqual", float3, float3);
- symbolTable.insertBuiltIn(bool4, "greaterThanEqual", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThanEqual", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThanEqual", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThanEqual", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "greaterThanEqual", int2, int2);
- symbolTable.insertBuiltIn(bool3, "greaterThanEqual", int3, int3);
- symbolTable.insertBuiltIn(bool4, "greaterThanEqual", int4, int4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThanEqual", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThanEqual", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThanEqual", int4, int4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "equal", float2, float2);
- symbolTable.insertBuiltIn(bool3, "equal", float3, float3);
- symbolTable.insertBuiltIn(bool4, "equal", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "equal", int2, int2);
- symbolTable.insertBuiltIn(bool3, "equal", int3, int3);
- symbolTable.insertBuiltIn(bool4, "equal", int4, int4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", int4, int4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "equal", bool2, bool2);
- symbolTable.insertBuiltIn(bool3, "equal", bool3, bool3);
- symbolTable.insertBuiltIn(bool4, "equal", bool4, bool4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", bool2, bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", bool3, bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", bool4, bool4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "notEqual", float2, float2);
- symbolTable.insertBuiltIn(bool3, "notEqual", float3, float3);
- symbolTable.insertBuiltIn(bool4, "notEqual", float4, float4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", float2, float2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", float3, float3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", float4, float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "notEqual", int2, int2);
- symbolTable.insertBuiltIn(bool3, "notEqual", int3, int3);
- symbolTable.insertBuiltIn(bool4, "notEqual", int4, int4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", int2, int2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", int3, int3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", int4, int4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "notEqual", bool2, bool2);
- symbolTable.insertBuiltIn(bool3, "notEqual", bool3, bool3);
- symbolTable.insertBuiltIn(bool4, "notEqual", bool4, bool4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", bool2, bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", bool3, bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", bool4, bool4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool1, "any", bool2);
- symbolTable.insertBuiltIn(bool1, "any", bool3);
- symbolTable.insertBuiltIn(bool1, "any", bool4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool1, "all", bool2);
- symbolTable.insertBuiltIn(bool1, "all", bool3);
- symbolTable.insertBuiltIn(bool1, "all", bool4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(bool2, "not", bool2);
- symbolTable.insertBuiltIn(bool3, "not", bool3);
- symbolTable.insertBuiltIn(bool4, "not", bool4);
</del><ins>+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "not", bool2);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "not", bool3);
+ symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "not", bool4);
</ins><span class="cx">
</span><del>- TType *sampler2D = new TType(EbtSampler2D, EbpUndefined, EvqGlobal, 1);
- TType *samplerCube = new TType(EbtSamplerCube, EbpUndefined, EvqGlobal, 1);
</del><ins>+ TType *sampler2D = new TType(EbtSampler2D);
+ TType *samplerCube = new TType(EbtSamplerCube);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Texture Functions for GLSL ES 1.0
</span><span class="cx"> //
</span><del>- symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, float2);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float3);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float4);
- symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, float3);
</del><ins>+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3);
</ins><span class="cx">
</span><span class="cx"> if (resources.OES_EGL_image_external)
</span><span class="cx"> {
</span><del>- TType *samplerExternalOES = new TType(EbtSamplerExternalOES, EbpUndefined, EvqGlobal, 1);
</del><ins>+ TType *samplerExternalOES = new TType(EbtSamplerExternalOES);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float4, "texture2D", samplerExternalOES, float2);
- symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, float3);
- symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, float4);
</del><ins>+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float4);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (resources.ARB_texture_rectangle)
</span><span class="cx"> {
</span><del>- TType *sampler2DRect = new TType(EbtSampler2DRect, EbpUndefined, EvqGlobal, 1);
</del><ins>+ TType *sampler2DRect = new TType(EbtSampler2DRect);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float4, "texture2DRect", sampler2DRect, float2);
- symbolTable.insertBuiltIn(float4, "texture2DRectProj", sampler2DRect, float3);
- symbolTable.insertBuiltIn(float4, "texture2DRectProj", sampler2DRect, float4);
</del><ins>+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRect", sampler2DRect, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, float4);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (resources.EXT_shader_texture_lod)
+ {
+ /* The *Grad* variants are new to both vertex and fragment shaders; the fragment
+ * shader specific pieces are added separately below.
+ */
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DGradEXT", sampler2D, float2, float2, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjGradEXT", sampler2D, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjGradEXT", sampler2D, float4, float2, float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeGradEXT", samplerCube, float3, float3, float3);
+ }
+
</ins><span class="cx"> if (type == SH_FRAGMENT_SHADER)
</span><span class="cx"> {
</span><del>- symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float3, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float4, float1);
- symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, float3, float1);
</del><ins>+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3, float1);
</ins><span class="cx">
</span><span class="cx"> if (resources.OES_standard_derivatives)
</span><span class="cx"> {
</span><del>- symbolTable.insertBuiltIn(float1, "dFdx", float1);
- symbolTable.insertBuiltIn(float2, "dFdx", float2);
- symbolTable.insertBuiltIn(float3, "dFdx", float3);
- symbolTable.insertBuiltIn(float4, "dFdx", float4);
-
- symbolTable.insertBuiltIn(float1, "dFdy", float1);
- symbolTable.insertBuiltIn(float2, "dFdy", float2);
- symbolTable.insertBuiltIn(float3, "dFdy", float3);
- symbolTable.insertBuiltIn(float4, "dFdy", float4);
</del><ins>+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, "dFdx", float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, "dFdx", float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, "dFdx", float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "dFdx", float4);
</ins><span class="cx">
</span><del>- symbolTable.insertBuiltIn(float1, "fwidth", float1);
- symbolTable.insertBuiltIn(float2, "fwidth", float2);
- symbolTable.insertBuiltIn(float3, "fwidth", float3);
- symbolTable.insertBuiltIn(float4, "fwidth", float4);
</del><ins>+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, "dFdy", float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, "dFdy", float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, "dFdy", float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "dFdy", float4);
+
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, "fwidth", float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, "fwidth", float2);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, "fwidth", float3);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "fwidth", float4);
</ins><span class="cx"> }
</span><ins>+
+ if (resources.EXT_shader_texture_lod)
+ {
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLodEXT", sampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLodEXT", sampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLodEXT", sampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLodEXT", samplerCube, float3, float1);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if(type == SH_VERTEX_SHADER)
</span><span class="cx"> {
</span><del>- symbolTable.insertBuiltIn(float4, "texture2DLod", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, float3, float1);
- symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, float4, float1);
- symbolTable.insertBuiltIn(float4, "textureCubeLod", samplerCube, float3, float1);
</del><ins>+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3, float1);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ TType *gvec4 = new TType(EbtGVec4);
+
+ TType *gsampler2D = new TType(EbtGSampler2D);
+ TType *gsamplerCube = new TType(EbtGSamplerCube);
+ TType *gsampler3D = new TType(EbtGSampler3D);
+ TType *gsampler2DArray = new TType(EbtGSampler2DArray);
+
</ins><span class="cx"> //
</span><ins>+ // Texture Functions for GLSL ES 3.0
+ //
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1);
+
+ if (type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1);
+ }
+
+ TType *sampler2DShadow = new TType(EbtSampler2DShadow);
+ TType *samplerCubeShadow = new TType(EbtSamplerCubeShadow);
+ TType *sampler2DArrayShadow = new TType(EbtSampler2DArrayShadow);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1);
+
+ if (type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4, float1);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1);
+
+ if(type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "dFdx", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "dFdx", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, "dFdx", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "dFdx", float4);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "dFdy", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "dFdy", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, "dFdy", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "dFdy", float4);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "fwidth", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "fwidth", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, "fwidth", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "fwidth", float4);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2);
+
+ if(type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2, float1);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2);
+
+ if(type == SH_FRAGMENT_SHADER)
+ {
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2, float1);
+ }
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, float1, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, float1);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, float1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, float1, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, float4, float1, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3, int1, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4, float2, float2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3, float3, float3, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow, float4, float2, float2, int2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2, float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3, float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4, float2, float2);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4, float2, float2, int2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4, float3, float3, int3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow, float4, float2, float2, int2);
+
+ //
</ins><span class="cx"> // Depth range in window coordinates
</span><span class="cx"> //
</span><span class="cx"> TFieldList *fields = NewPoolTFieldList();
</span><del>- TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"));
- TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"));
- TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"));
</del><ins>+ TSourceLoc zeroSourceLoc = {0};
+ TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"), zeroSourceLoc);
+ TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"), zeroSourceLoc);
+ TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"), zeroSourceLoc);
</ins><span class="cx"> fields->push_back(near);
</span><span class="cx"> fields->push_back(far);
</span><span class="cx"> fields->push_back(diff);
</span><span class="cx"> TStructure *depthRangeStruct = new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields);
</span><span class="cx"> TVariable *depthRangeParameters = new TVariable(&depthRangeStruct->name(), depthRangeStruct, true);
</span><del>- symbolTable.insert(*depthRangeParameters);
</del><ins>+ symbolTable.insert(COMMON_BUILTINS, *depthRangeParameters);
</ins><span class="cx"> TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct));
</span><span class="cx"> depthRange->setQualifier(EvqUniform);
</span><del>- symbolTable.insert(*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="cx"> //
</span><del>- symbolTable.insertConstInt("gl_MaxVertexAttribs", resources.MaxVertexAttribs);
- symbolTable.insertConstInt("gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors);
- symbolTable.insertConstInt("gl_MaxVaryingVectors", resources.MaxVaryingVectors);
- symbolTable.insertConstInt("gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits);
- symbolTable.insertConstInt("gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
- symbolTable.insertConstInt("gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
- symbolTable.insertConstInt("gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
</del><ins>+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
</ins><span class="cx">
</span><ins>+ symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors);
+
</ins><span class="cx"> if (spec != SH_CSS_SHADERS_SPEC)
</span><span class="cx"> {
</span><del>- symbolTable.insertConstInt("gl_MaxDrawBuffers", resources.MaxDrawBuffers);
</del><ins>+ symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers);
</ins><span class="cx"> }
</span><ins>+
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors", resources.MaxVertexOutputVectors);
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxFragmentInputVectors", resources.MaxFragmentInputVectors);
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MinProgramTexelOffset", resources.MinProgramTexelOffset);
+ symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
</span><span class="lines">@@ -428,31 +604,31 @@
</span><span class="cx"> //
</span><span class="cx"> switch(type) {
</span><span class="cx"> case SH_FRAGMENT_SHADER:
</span><del>- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
</del><ins>+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointCoord"), 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><span class="cx"> if (spec != SH_CSS_SHADERS_SPEC) {
</span><del>- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
</del><ins>+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
</ins><span class="cx"> if (resources.EXT_frag_depth) {
</span><del>- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragDepthEXT"), TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
- symbolTable.relateToExtension("gl_FragDepthEXT", "GL_EXT_frag_depth");
</del><ins>+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragDepthEXT"), TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "gl_FragDepthEXT", "GL_EXT_frag_depth");
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- symbolTable.insert(*new TVariable(NewPoolTString("css_MixColor"), TType(EbtFloat, EbpMedium, EvqGlobal, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("css_ColorMatrix"), TType(EbtFloat, EbpMedium, EvqGlobal, 4, true)));
</del><ins>+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_MixColor"), TType(EbtFloat, EbpMedium, EvqGlobal, 4)));
+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_ColorMatrix"), TType(EbtFloat, EbpMedium, EvqGlobal, 4, 4)));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case SH_VERTEX_SHADER:
</span><del>- symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
</del><ins>+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
+ symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default: assert(false && "Language not supported");
</span><span class="lines">@@ -464,84 +640,102 @@
</span><span class="cx"> // expected to be resolved through a library of functions, versus as
</span><span class="cx"> // operations.
</span><span class="cx"> //
</span><del>- symbolTable.relateToOperator("matrixCompMult", EOpMul);
</del><ins>+ symbolTable.relateToOperator(COMMON_BUILTINS, "matrixCompMult", EOpMul);
</ins><span class="cx">
</span><del>- symbolTable.relateToOperator("equal", EOpVectorEqual);
- symbolTable.relateToOperator("notEqual", EOpVectorNotEqual);
- symbolTable.relateToOperator("lessThan", EOpLessThan);
- symbolTable.relateToOperator("greaterThan", EOpGreaterThan);
- symbolTable.relateToOperator("lessThanEqual", EOpLessThanEqual);
- symbolTable.relateToOperator("greaterThanEqual", EOpGreaterThanEqual);
</del><ins>+ symbolTable.relateToOperator(COMMON_BUILTINS, "equal", EOpVectorEqual);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "notEqual", EOpVectorNotEqual);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "lessThan", EOpLessThan);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThan", EOpGreaterThan);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "lessThanEqual", EOpLessThanEqual);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThanEqual", EOpGreaterThanEqual);
</ins><span class="cx">
</span><del>- symbolTable.relateToOperator("radians", EOpRadians);
- symbolTable.relateToOperator("degrees", EOpDegrees);
- symbolTable.relateToOperator("sin", EOpSin);
- symbolTable.relateToOperator("cos", EOpCos);
- symbolTable.relateToOperator("tan", EOpTan);
- symbolTable.relateToOperator("asin", EOpAsin);
- symbolTable.relateToOperator("acos", EOpAcos);
- symbolTable.relateToOperator("atan", EOpAtan);
</del><ins>+ symbolTable.relateToOperator(COMMON_BUILTINS, "radians", EOpRadians);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "degrees", EOpDegrees);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "sin", EOpSin);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "cos", EOpCos);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "tan", EOpTan);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "asin", EOpAsin);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "acos", EOpAcos);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "atan", EOpAtan);
</ins><span class="cx">
</span><del>- symbolTable.relateToOperator("pow", EOpPow);
- symbolTable.relateToOperator("exp2", EOpExp2);
- symbolTable.relateToOperator("log", EOpLog);
- symbolTable.relateToOperator("exp", EOpExp);
- symbolTable.relateToOperator("log2", EOpLog2);
- symbolTable.relateToOperator("sqrt", EOpSqrt);
- symbolTable.relateToOperator("inversesqrt", EOpInverseSqrt);
</del><ins>+ symbolTable.relateToOperator(COMMON_BUILTINS, "pow", EOpPow);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "exp2", EOpExp2);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "log", EOpLog);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "exp", EOpExp);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "log2", EOpLog2);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "sqrt", EOpSqrt);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "inversesqrt", EOpInverseSqrt);
</ins><span class="cx">
</span><del>- symbolTable.relateToOperator("abs", EOpAbs);
- symbolTable.relateToOperator("sign", EOpSign);
- symbolTable.relateToOperator("floor", EOpFloor);
- symbolTable.relateToOperator("ceil", EOpCeil);
- symbolTable.relateToOperator("fract", EOpFract);
- symbolTable.relateToOperator("mod", EOpMod);
- symbolTable.relateToOperator("min", EOpMin);
- symbolTable.relateToOperator("max", EOpMax);
- symbolTable.relateToOperator("clamp", EOpClamp);
- symbolTable.relateToOperator("mix", EOpMix);
- symbolTable.relateToOperator("step", EOpStep);
- symbolTable.relateToOperator("smoothstep", EOpSmoothStep);
</del><ins>+ symbolTable.relateToOperator(COMMON_BUILTINS, "abs", EOpAbs);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "sign", EOpSign);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "floor", EOpFloor);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "ceil", EOpCeil);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "fract", EOpFract);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "mod", EOpMod);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "min", EOpMin);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "max", EOpMax);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "clamp", EOpClamp);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "mix", EOpMix);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "step", EOpStep);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "smoothstep", EOpSmoothStep);
</ins><span class="cx">
</span><del>- symbolTable.relateToOperator("length", EOpLength);
- symbolTable.relateToOperator("distance", EOpDistance);
- symbolTable.relateToOperator("dot", EOpDot);
- symbolTable.relateToOperator("cross", EOpCross);
- symbolTable.relateToOperator("normalize", EOpNormalize);
- symbolTable.relateToOperator("faceforward", EOpFaceForward);
- symbolTable.relateToOperator("reflect", EOpReflect);
- symbolTable.relateToOperator("refract", EOpRefract);
-
- symbolTable.relateToOperator("any", EOpAny);
- symbolTable.relateToOperator("all", EOpAll);
- symbolTable.relateToOperator("not", EOpVectorLogicalNot);
</del><ins>+ symbolTable.relateToOperator(COMMON_BUILTINS, "length", EOpLength);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "distance", EOpDistance);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "dot", EOpDot);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "cross", EOpCross);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "normalize", EOpNormalize);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "faceforward", EOpFaceForward);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "reflect", EOpReflect);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "refract", EOpRefract);
</ins><span class="cx">
</span><ins>+ symbolTable.relateToOperator(COMMON_BUILTINS, "any", EOpAny);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "all", EOpAll);
+ symbolTable.relateToOperator(COMMON_BUILTINS, "not", EOpVectorLogicalNot);
+
</ins><span class="cx"> // Map language-specific operators.
</span><span class="cx"> switch(type) {
</span><span class="cx"> case SH_VERTEX_SHADER:
</span><span class="cx"> break;
</span><span class="cx"> case SH_FRAGMENT_SHADER:
</span><del>- if (resources.OES_standard_derivatives) {
- symbolTable.relateToOperator("dFdx", EOpDFdx);
- symbolTable.relateToOperator("dFdy", EOpDFdy);
- symbolTable.relateToOperator("fwidth", EOpFwidth);
</del><ins>+ if (resources.OES_standard_derivatives)
+ {
+ symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdx", EOpDFdx);
+ symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdy", EOpDFdy);
+ symbolTable.relateToOperator(ESSL1_BUILTINS, "fwidth", EOpFwidth);
</ins><span class="cx">
</span><del>- symbolTable.relateToExtension("dFdx", "GL_OES_standard_derivatives");
- symbolTable.relateToExtension("dFdy", "GL_OES_standard_derivatives");
- symbolTable.relateToExtension("fwidth", "GL_OES_standard_derivatives");
</del><ins>+ symbolTable.relateToExtension(ESSL1_BUILTINS, "dFdx", "GL_OES_standard_derivatives");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "dFdy", "GL_OES_standard_derivatives");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "fwidth", "GL_OES_standard_derivatives");
</ins><span class="cx"> }
</span><ins>+ if (resources.EXT_shader_texture_lod)
+ {
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DLodEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DProjLodEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "textureCubeLodEXT", "GL_EXT_shader_texture_lod");
+ }
</ins><span class="cx"> break;
</span><span class="cx"> default: break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ symbolTable.relateToOperator(ESSL3_BUILTINS, "dFdx", EOpDFdx);
+ symbolTable.relateToOperator(ESSL3_BUILTINS, "dFdy", EOpDFdy);
+ symbolTable.relateToOperator(ESSL3_BUILTINS, "fwidth", EOpFwidth);
+
+ if (resources.EXT_shader_texture_lod)
+ {
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DGradEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "texture2DProjGradEXT", "GL_EXT_shader_texture_lod");
+ symbolTable.relateToExtension(ESSL1_BUILTINS, "textureCubeGradEXT", "GL_EXT_shader_texture_lod");
+ }
+
</ins><span class="cx"> // Finally add resource-specific variables.
</span><span class="cx"> switch(type) {
</span><span class="cx"> case SH_FRAGMENT_SHADER:
</span><span class="cx"> if (spec != SH_CSS_SHADERS_SPEC) {
</span><span class="cx"> // Set up gl_FragData. The array size.
</span><del>- TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, false, true);
</del><ins>+ TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
</ins><span class="cx"> fragData.setArraySize(resources.MaxDrawBuffers);
</span><del>- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));
</del><ins>+ symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData"), fragData));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> default: break;
</span><span class="lines">@@ -561,4 +755,6 @@
</span><span class="cx"> extBehavior["GL_EXT_draw_buffers"] = EBhUndefined;
</span><span class="cx"> if (resources.EXT_frag_depth)
</span><span class="cx"> extBehavior["GL_EXT_frag_depth"] = EBhUndefined;
</span><ins>+ if (resources.EXT_shader_texture_lod)
+ extBehavior["GL_EXT_shader_texture_lod"] = EBhUndefined;
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorIntermTraversecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermTraverse.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermTraverse.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermTraverse.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> //
</span><span class="cx"> if (it->preVisit)
</span><span class="cx"> visit = it->visitBinary(PreVisit, this);
</span><del>-
</del><ins>+
</ins><span class="cx"> //
</span><span class="cx"> // Visit the children, in the right order.
</span><span class="cx"> //
</span><span class="lines">@@ -53,11 +53,11 @@
</span><span class="cx"> {
</span><span class="cx"> it->incrementDepth(this);
</span><span class="cx">
</span><del>- if (it->rightToLeft)
</del><ins>+ if (it->rightToLeft)
</ins><span class="cx"> {
</span><span class="cx"> if (right)
</span><span class="cx"> right->traverse(it);
</span><del>-
</del><ins>+
</ins><span class="cx"> if (it->inVisit)
</span><span class="cx"> visit = it->visitBinary(InVisit, this);
</span><span class="cx">
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (left)
</span><span class="cx"> left->traverse(it);
</span><del>-
</del><ins>+
</ins><span class="cx"> if (it->inVisit)
</span><span class="cx"> visit = it->visitBinary(InVisit, this);
</span><span class="cx">
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx"> operand->traverse(it);
</span><span class="cx"> it->decrementDepth();
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> if (visit && it->postVisit)
</span><span class="cx"> it->visitUnary(PostVisit, this);
</span><span class="cx"> }
</span><span class="lines">@@ -113,10 +113,10 @@
</span><span class="cx"> void TIntermAggregate::traverse(TIntermTraverser *it)
</span><span class="cx"> {
</span><span class="cx"> bool visit = true;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (it->preVisit)
</span><span class="cx"> visit = it->visitAggregate(PreVisit, this);
</span><del>-
</del><ins>+
</ins><span class="cx"> if (visit)
</span><span class="cx"> {
</span><span class="cx"> it->incrementDepth(this);
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> it->decrementDepth();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx">
</span><span class="cx"> if (it->preVisit)
</span><span class="cx"> visit = it->visitSelection(PreVisit, this);
</span><del>-
</del><ins>+
</ins><span class="cx"> if (visit) {
</span><span class="cx"> it->incrementDepth(this);
</span><span class="cx"> if (it->rightToLeft) {
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx">
</span><span class="cx"> if (it->preVisit)
</span><span class="cx"> visit = it->visitLoop(PreVisit, this);
</span><del>-
</del><ins>+
</ins><span class="cx"> if (visit)
</span><span class="cx"> {
</span><span class="cx"> it->incrementDepth(this);
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">
</span><span class="cx"> if (it->preVisit)
</span><span class="cx"> visit = it->visitBranch(PreVisit, this);
</span><del>-
</del><ins>+
</ins><span class="cx"> if (visit && expression) {
</span><span class="cx"> it->incrementDepth(this);
</span><span class="cx"> expression->traverse(it);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorIntermediatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx"> #include "compiler/translator/localintermediate.h"
</span><span class="cx"> #include "compiler/translator/QualifierAlive.h"
</span><span class="cx"> #include "compiler/translator/RemoveTree.h"
</span><ins>+#include "compiler/translator/SymbolTable.h"
</ins><span class="cx">
</span><span class="cx"> bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
</span><span class="cx">
</span><span class="lines">@@ -44,7 +45,8 @@
</span><span class="cx"> case EOpIndexDirect:
</span><span class="cx"> case EOpIndexIndirect: return "[]";
</span><span class="cx">
</span><del>- case EOpIndexDirectStruct: return ".";
</del><ins>+ case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock: return ".";
</ins><span class="cx"> case EOpVectorSwizzle: return ".";
</span><span class="cx"> case EOpAdd: return "+";
</span><span class="cx"> case EOpSub: return "-";
</span><span class="lines">@@ -78,16 +80,24 @@
</span><span class="cx">
</span><span class="cx"> // Fall-through.
</span><span class="cx"> case EOpConvIntToBool:
</span><ins>+ case EOpConvUIntToBool:
</ins><span class="cx"> case EOpConvFloatToBool: return "bool";
</span><span class="cx">
</span><span class="cx"> // Fall-through.
</span><span class="cx"> case EOpConvBoolToFloat:
</span><ins>+ case EOpConvUIntToFloat:
</ins><span class="cx"> case EOpConvIntToFloat: return "float";
</span><span class="cx">
</span><span class="cx"> // Fall-through.
</span><span class="cx"> case EOpConvFloatToInt:
</span><ins>+ case EOpConvUIntToInt:
</ins><span class="cx"> case EOpConvBoolToInt: return "int";
</span><span class="cx">
</span><ins>+ // Fall-through.
+ case EOpConvIntToUInt:
+ case EOpConvFloatToUInt:
+ case EOpConvBoolToUInt: return "uint";
+
</ins><span class="cx"> case EOpRadians: return "radians";
</span><span class="cx"> case EOpDegrees: return "degrees";
</span><span class="cx"> case EOpSin: return "sin";
</span><span class="lines">@@ -146,7 +156,7 @@
</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& line, TSymbolTable& symbolTable)
</del><ins>+TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& line)
</ins><span class="cx"> {
</span><span class="cx"> switch (op) {
</span><span class="cx"> case EOpEqual:
</span><span class="lines">@@ -212,11 +222,10 @@
</span><span class="cx"> //
</span><span class="cx"> // See if we can fold constants.
</span><span class="cx"> //
</span><del>- TIntermTyped* typedReturnNode = 0;
</del><span class="cx"> TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
</span><span class="cx"> TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
</span><span class="cx"> if (leftTempConstant && rightTempConstant) {
</span><del>- typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
</del><ins>+ TIntermTyped *typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
</ins><span class="cx">
</span><span class="cx"> if (typedReturnNode)
</span><span class="cx"> return typedReturnNode;
</span><span class="lines">@@ -275,7 +284,7 @@
</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& line, TSymbolTable& symbolTable)
</del><ins>+TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, const TSourceLoc& line)
</ins><span class="cx"> {
</span><span class="cx"> TIntermUnary* node;
</span><span class="cx"> TIntermTyped* child = childNode->getAsTyped();
</span><span class="lines">@@ -310,6 +319,7 @@
</span><span class="cx"> TBasicType newType = EbtVoid;
</span><span class="cx"> switch (op) {
</span><span class="cx"> case EOpConstructInt: newType = EbtInt; break;
</span><ins>+ case EOpConstructUInt: newType = EbtUInt; break;
</ins><span class="cx"> case EOpConstructBool: newType = EbtBool; break;
</span><span class="cx"> case EOpConstructFloat: newType = EbtFloat; break;
</span><span class="cx"> default: break;
</span><span class="lines">@@ -318,7 +328,7 @@
</span><span class="cx"> if (newType != EbtVoid) {
</span><span class="cx"> child = addConversion(op, TType(newType, child->getPrecision(), EvqTemporary,
</span><span class="cx"> child->getNominalSize(),
</span><del>- child->isMatrix(),
</del><ins>+ child->getSecondarySize(),
</ins><span class="cx"> child->isArray()),
</span><span class="cx"> child);
</span><span class="cx"> if (child == 0)
</span><span class="lines">@@ -330,6 +340,7 @@
</span><span class="cx"> //
</span><span class="cx"> switch (op) {
</span><span class="cx"> case EOpConstructInt:
</span><ins>+ case EOpConstructUInt:
</ins><span class="cx"> case EOpConstructBool:
</span><span class="cx"> case EOpConstructFloat:
</span><span class="cx"> return child;
</span><span class="lines">@@ -411,12 +422,10 @@
</span><span class="cx"> //
</span><span class="cx"> // Does the base type allow operation?
</span><span class="cx"> //
</span><del>- switch (node->getBasicType()) {
- case EbtVoid:
- case EbtSampler2D:
- case EbtSamplerCube:
- return 0;
- default: break;
</del><ins>+ if (node->getBasicType() == EbtVoid ||
+ IsSampler(node->getBasicType()))
+ {
+ return 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -452,6 +461,9 @@
</span><span class="cx"> case EOpConstructInt:
</span><span class="cx"> promoteTo = EbtInt;
</span><span class="cx"> break;
</span><ins>+ case EOpConstructUInt:
+ promoteTo = EbtUInt;
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> //
</span><span class="cx"> // implicit conversions were removed from the language.
</span><span class="lines">@@ -479,8 +491,9 @@
</span><span class="cx"> switch (promoteTo) {
</span><span class="cx"> case EbtFloat:
</span><span class="cx"> switch (node->getBasicType()) {
</span><del>- case EbtInt: newOp = EOpConvIntToFloat; break;
- case EbtBool: newOp = EOpConvBoolToFloat; break;
</del><ins>+ case EbtInt: newOp = EOpConvIntToFloat; break;
+ case EbtUInt: newOp = EOpConvFloatToUInt; break;
+ case EbtBool: newOp = EOpConvBoolToFloat; break;
</ins><span class="cx"> default:
</span><span class="cx"> infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
</span><span class="cx"> return 0;
</span><span class="lines">@@ -488,8 +501,9 @@
</span><span class="cx"> break;
</span><span class="cx"> case EbtBool:
</span><span class="cx"> switch (node->getBasicType()) {
</span><del>- case EbtInt: newOp = EOpConvIntToBool; break;
- case EbtFloat: newOp = EOpConvFloatToBool; break;
</del><ins>+ case EbtInt: newOp = EOpConvIntToBool; break;
+ case EbtUInt: newOp = EOpConvBoolToUInt; break;
+ case EbtFloat: newOp = EOpConvFloatToBool; break;
</ins><span class="cx"> default:
</span><span class="cx"> infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
</span><span class="cx"> return 0;
</span><span class="lines">@@ -497,6 +511,7 @@
</span><span class="cx"> break;
</span><span class="cx"> case EbtInt:
</span><span class="cx"> switch (node->getBasicType()) {
</span><ins>+ case EbtUInt: newOp = EOpConvUIntToInt; break;
</ins><span class="cx"> case EbtBool: newOp = EOpConvBoolToInt; break;
</span><span class="cx"> case EbtFloat: newOp = EOpConvFloatToInt; break;
</span><span class="cx"> default:
</span><span class="lines">@@ -504,12 +519,22 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+ case EbtUInt:
+ switch (node->getBasicType()) {
+ case EbtInt: newOp = EOpConvIntToUInt; break;
+ case EbtBool: newOp = EOpConvBoolToUInt; break;
+ case EbtFloat: newOp = EOpConvFloatToUInt; break;
+ default:
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion node");
+ return 0;
+ }
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> infoSink.info.message(EPrefixInternalError, node->getLine(), "Bad promotion type");
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- TType type(promoteTo, node->getPrecision(), EvqTemporary, node->getNominalSize(), node->isMatrix(), node->isArray());
</del><ins>+ TType type(promoteTo, node->getPrecision(), EvqTemporary, node->getNominalSize(), node->getSecondarySize(), node->isArray());
</ins><span class="cx"> newNode = new TIntermUnary(newOp, type);
</span><span class="cx"> newNode->setLine(node->getLine());
</span><span class="cx"> newNode->setOperand(node);
</span><span class="lines">@@ -559,6 +584,7 @@
</span><span class="cx">
</span><span class="cx"> TIntermAggregate* aggNode = new TIntermAggregate;
</span><span class="cx"> aggNode->getSequence().push_back(node);
</span><ins>+
</ins><span class="cx"> aggNode->setLine(line);
</span><span class="cx">
</span><span class="cx"> return aggNode;
</span><span class="lines">@@ -760,6 +786,26 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TIntermLoop::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (init)
+ {
+ nodeQueue->push(init);
+ }
+ if (cond)
+ {
+ nodeQueue->push(cond);
+ }
+ if (expr)
+ {
+ nodeQueue->push(expr);
+ }
+ if (body)
+ {
+ nodeQueue->push(body);
+ }
+}
+
</ins><span class="cx"> bool TIntermBranch::replaceChildNode(
</span><span class="cx"> TIntermNode *original, TIntermNode *replacement)
</span><span class="cx"> {
</span><span class="lines">@@ -767,6 +813,14 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TIntermBranch::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (expression)
+ {
+ nodeQueue->push(expression);
+ }
+}
+
</ins><span class="cx"> bool TIntermBinary::replaceChildNode(
</span><span class="cx"> TIntermNode *original, TIntermNode *replacement)
</span><span class="cx"> {
</span><span class="lines">@@ -775,6 +829,18 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TIntermBinary::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (left)
+ {
+ nodeQueue->push(left);
+ }
+ if (right)
+ {
+ nodeQueue->push(right);
+ }
+}
+
</ins><span class="cx"> bool TIntermUnary::replaceChildNode(
</span><span class="cx"> TIntermNode *original, TIntermNode *replacement)
</span><span class="cx"> {
</span><span class="lines">@@ -782,6 +848,14 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TIntermUnary::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (operand)
+ {
+ nodeQueue->push(operand);
+ }
+}
+
</ins><span class="cx"> bool TIntermAggregate::replaceChildNode(
</span><span class="cx"> TIntermNode *original, TIntermNode *replacement)
</span><span class="cx"> {
</span><span class="lines">@@ -792,6 +866,14 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TIntermAggregate::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ for (size_t childIndex = 0; childIndex < sequence.size(); childIndex++)
+ {
+ nodeQueue->push(sequence[childIndex]);
+ }
+}
+
</ins><span class="cx"> bool TIntermSelection::replaceChildNode(
</span><span class="cx"> TIntermNode *original, TIntermNode *replacement)
</span><span class="cx"> {
</span><span class="lines">@@ -801,6 +883,22 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TIntermSelection::enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const
+{
+ if (condition)
+ {
+ nodeQueue->push(condition);
+ }
+ if (trueBlock)
+ {
+ nodeQueue->push(trueBlock);
+ }
+ if (falseBlock)
+ {
+ nodeQueue->push(falseBlock);
+ }
+}
+
</ins><span class="cx"> //
</span><span class="cx"> // Say whether or not an operation node changes the value of a variable.
</span><span class="cx"> //
</span><span class="lines">@@ -843,6 +941,10 @@
</span><span class="cx"> case EOpConstructIVec3:
</span><span class="cx"> case EOpConstructIVec4:
</span><span class="cx"> case EOpConstructInt:
</span><ins>+ case EOpConstructUVec2:
+ case EOpConstructUVec3:
+ case EOpConstructUVec4:
+ case EOpConstructUInt:
</ins><span class="cx"> case EOpConstructBVec2:
</span><span class="cx"> case EOpConstructBVec3:
</span><span class="cx"> case EOpConstructBVec4:
</span><span class="lines">@@ -893,6 +995,36 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool validateMultiplication(TOperator op, const TType &left, const TType &right)
+{
+ switch (op)
+ {
+ case EOpMul:
+ case EOpMulAssign:
+ return left.getNominalSize() == right.getNominalSize() && left.getSecondarySize() == right.getSecondarySize();
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesScalarAssign:
+ return true;
+ case EOpVectorTimesMatrix:
+ return left.getNominalSize() == right.getRows();
+ case EOpVectorTimesMatrixAssign:
+ return left.getNominalSize() == right.getRows() && 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() && left.getRows() == right.getRows();
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
</ins><span class="cx"> //
</span><span class="cx"> // Establishes the type of the resultant operation, as well as
</span><span class="cx"> // makes the operator the correct one for the operands.
</span><span class="lines">@@ -902,7 +1034,8 @@
</span><span class="cx"> bool TIntermBinary::promote(TInfoSink& infoSink)
</span><span class="cx"> {
</span><span class="cx"> // This function only handles scalars, vectors, and matrices.
</span><del>- if (left->isArray() || right->isArray()) {
</del><ins>+ if (left->isArray() || right->isArray())
+ {
</ins><span class="cx"> infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operation for arrays");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -924,17 +1057,20 @@
</span><span class="cx">
</span><span class="cx"> // Binary operations results in temporary variables unless both
</span><span class="cx"> // operands are const.
</span><del>- if (left->getQualifier() != EvqConst || right->getQualifier() != EvqConst) {
</del><ins>+ if (left->getQualifier() != EvqConst || right->getQualifier() != EvqConst)
+ {
</ins><span class="cx"> getTypePointer()->setQualifier(EvqTemporary);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- int size = std::max(left->getNominalSize(), right->getNominalSize());
</del><ins>+ const int nominalSize = std::max(left->getNominalSize(), right->getNominalSize());
</ins><span class="cx">
</span><span class="cx"> //
</span><del>- // All scalars. Code after this test assumes this case is removed!
</del><ins>+ // All scalars or structs. Code after this test assumes this case is removed!
</ins><span class="cx"> //
</span><del>- if (size == 1) {
- switch (op) {
</del><ins>+ if (nominalSize == 1)
+ {
+ switch (op)
+ {
</ins><span class="cx"> //
</span><span class="cx"> // Promote to conditional
</span><span class="cx"> //
</span><span class="lines">@@ -954,7 +1090,9 @@
</span><span class="cx"> case EOpLogicalOr:
</span><span class="cx"> // Both operands must be of type bool.
</span><span class="cx"> if (left->getBasicType() != EbtBool || right->getBasicType() != EbtBool)
</span><ins>+ {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx"> setType(TType(EbtBool, EbpUndefined));
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -966,80 +1104,118 @@
</span><span class="cx">
</span><span class="cx"> // If we reach here, at least one of the operands is vector or matrix.
</span><span class="cx"> // The other operand could be a scalar, vector, or matrix.
</span><del>- // Are the sizes compatible?
- //
- if (left->getNominalSize() != right->getNominalSize()) {
- // If the nominal size of operands do not match:
- // One of them must be scalar.
- if (left->getNominalSize() != 1 && right->getNominalSize() != 1)
- return false;
- // Operator cannot be of type pure assignment.
- if (op == EOpAssign || op == EOpInitialize)
- return false;
- }
-
- //
</del><span class="cx"> // Can these two operands be combined?
</span><span class="cx"> //
</span><span class="cx"> TBasicType basicType = left->getBasicType();
</span><del>- switch (op) {
</del><ins>+ switch (op)
+ {
</ins><span class="cx"> case EOpMul:
</span><del>- if (!left->isMatrix() && right->isMatrix()) {
</del><ins>+ if (!left->isMatrix() && right->isMatrix())
+ {
</ins><span class="cx"> if (left->isVector())
</span><ins>+ {
</ins><span class="cx"> op = EOpVectorTimesMatrix;
</span><del>- else {
</del><ins>+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), 1));
+ }
+ else
+ {
</ins><span class="cx"> op = EOpMatrixTimesScalar;
</span><del>- setType(TType(basicType, higherPrecision, EvqTemporary, size, true));
</del><ins>+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), right->getRows()));
</ins><span class="cx"> }
</span><del>- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
</del><ins>+ }
+ else if (left->isMatrix() && !right->isMatrix())
+ {
+ if (right->isVector())
+ {
</ins><span class="cx"> op = EOpMatrixTimesVector;
</span><del>- setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
- } else {
</del><ins>+ setType(TType(basicType, higherPrecision, EvqTemporary, left->getRows(), 1));
+ }
+ else
+ {
</ins><span class="cx"> op = EOpMatrixTimesScalar;
</span><span class="cx"> }
</span><del>- } else if (left->isMatrix() && right->isMatrix()) {
</del><ins>+ }
+ else if (left->isMatrix() && right->isMatrix())
+ {
</ins><span class="cx"> op = EOpMatrixTimesMatrix;
</span><del>- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
</del><ins>+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), left->getRows()));
+ }
+ else if (!left->isMatrix() && !right->isMatrix())
+ {
+ if (left->isVector() && right->isVector())
+ {
</ins><span class="cx"> // leave as component product
</span><del>- } else if (left->isVector() || right->isVector()) {
</del><ins>+ }
+ else if (left->isVector() || right->isVector())
+ {
</ins><span class="cx"> op = EOpVectorTimesScalar;
</span><del>- setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
</del><ins>+ setType(TType(basicType, higherPrecision, EvqTemporary, nominalSize, 1));
</ins><span class="cx"> }
</span><del>- } else {
</del><ins>+ }
+ else
+ {
</ins><span class="cx"> infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
+ if (!validateMultiplication(op, left->getType(), right->getType()))
+ {
+ return false;
+ }
</ins><span class="cx"> break;
</span><ins>+
</ins><span class="cx"> case EOpMulAssign:
</span><del>- if (!left->isMatrix() && right->isMatrix()) {
</del><ins>+ if (!left->isMatrix() && right->isMatrix())
+ {
</ins><span class="cx"> if (left->isVector())
</span><ins>+ {
</ins><span class="cx"> op = EOpVectorTimesMatrixAssign;
</span><del>- else {
</del><ins>+ }
+ else
+ {
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
</del><ins>+ }
+ else if (left->isMatrix() && !right->isMatrix())
+ {
+ if (right->isVector())
+ {
</ins><span class="cx"> return false;
</span><del>- } else {
</del><ins>+ }
+ else
+ {
</ins><span class="cx"> op = EOpMatrixTimesScalarAssign;
</span><span class="cx"> }
</span><del>- } else if (left->isMatrix() && right->isMatrix()) {
</del><ins>+ }
+ else if (left->isMatrix() && right->isMatrix())
+ {
</ins><span class="cx"> op = EOpMatrixTimesMatrixAssign;
</span><del>- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
</del><ins>+ setType(TType(basicType, higherPrecision, EvqTemporary, right->getCols(), left->getRows()));
+ }
+ else if (!left->isMatrix() && !right->isMatrix())
+ {
+ if (left->isVector() && right->isVector())
+ {
</ins><span class="cx"> // leave as component product
</span><del>- } else if (left->isVector() || right->isVector()) {
</del><ins>+ }
+ else if (left->isVector() || right->isVector())
+ {
</ins><span class="cx"> if (! left->isVector())
</span><span class="cx"> return false;
</span><span class="cx"> op = EOpVectorTimesScalarAssign;
</span><del>- setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
</del><ins>+ setType(TType(basicType, higherPrecision, EvqTemporary, left->getNominalSize(), 1));
</ins><span class="cx"> }
</span><del>- } else {
</del><ins>+ }
+ else
+ {
</ins><span class="cx"> infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
+ if (!validateMultiplication(op, left->getType(), right->getType()))
+ {
+ return false;
+ }
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case EOpAssign:
</span><span class="lines">@@ -1050,10 +1226,28 @@
</span><span class="cx"> case EOpAddAssign:
</span><span class="cx"> case EOpSubAssign:
</span><span class="cx"> case EOpDivAssign:
</span><del>- if ((left->isMatrix() && right->isVector()) ||
- (left->isVector() && right->isMatrix()))
- return false;
- setType(TType(basicType, higherPrecision, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
</del><ins>+ {
+ if ((left->isMatrix() && right->isVector()) ||
+ (left->isVector() && right->isMatrix()))
+ return false;
+
+ // Are the sizes compatible?
+ if (left->getNominalSize() != right->getNominalSize() || left->getSecondarySize() != right->getSecondarySize())
+ {
+ // If the nominal size of operands do not match:
+ // One of them must be scalar.
+ if (!left->isScalar() && !right->isScalar())
+ return false;
+
+ // Operator cannot be of type pure assignment.
+ if (op == EOpAssign || op == EOpInitialize)
+ return false;
+ }
+
+ const int secondarySize = std::max(left->getSecondarySize(), right->getSecondarySize());
+
+ setType(TType(basicType, higherPrecision, EvqTemporary, nominalSize, secondarySize));
+ }
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case EOpEqual:
</span><span class="lines">@@ -1062,8 +1256,8 @@
</span><span class="cx"> case EOpGreaterThan:
</span><span class="cx"> case EOpLessThanEqual:
</span><span class="cx"> case EOpGreaterThanEqual:
</span><del>- if ((left->isMatrix() && right->isVector()) ||
- (left->isVector() && right->isMatrix()))
</del><ins>+ if ((left->getNominalSize() != right->getNominalSize()) ||
+ (left->getSecondarySize() != right->getSecondarySize()))
</ins><span class="cx"> return false;
</span><span class="cx"> setType(TType(EbtBool, EbpUndefined));
</span><span class="cx"> break;
</span><span class="lines">@@ -1086,13 +1280,14 @@
</span><span class="cx"> size_t size = fields[j]->type()->getObjectSize();
</span><span class="cx"> for (size_t i = 0; i < size; i++) {
</span><span class="cx"> if (fields[j]->type()->getBasicType() == EbtStruct) {
</span><del>- if (!CompareStructure(*(fields[j]->type()), &rightUnionArray[index], &leftUnionArray[index]))
</del><ins>+ if (!CompareStructure(*fields[j]->type(), &rightUnionArray[index], &leftUnionArray[index]))
</ins><span class="cx"> return false;
</span><span class="cx"> } else {
</span><span class="cx"> if (leftUnionArray[index] != rightUnionArray[index])
</span><span class="cx"> return false;
</span><span class="cx"> index++;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="lines">@@ -1127,24 +1322,40 @@
</span><span class="cx"> TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink)
</span><span class="cx"> {
</span><span class="cx"> ConstantUnion *unionArray = getUnionArrayPointer();
</span><ins>+
+ if (!unionArray)
+ return 0;
+
</ins><span class="cx"> size_t objectSize = getType().getObjectSize();
</span><span class="cx">
</span><del>- if (constantNode) { // binary operations
</del><ins>+ if (constantNode)
+ {
+ // binary operations
</ins><span class="cx"> TIntermConstantUnion *node = constantNode->getAsConstantUnion();
</span><span class="cx"> ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
</span><span class="cx"> TType returnType = getType();
</span><span class="cx">
</span><ins>+ if (!rightUnionArray)
+ return 0;
+
</ins><span class="cx"> // for a case like float f = 1.2 + vec4(2,3,4,5);
</span><del>- if (constantNode->getType().getObjectSize() == 1 && objectSize > 1) {
</del><ins>+ if (constantNode->getType().getObjectSize() == 1 && objectSize > 1)
+ {
</ins><span class="cx"> rightUnionArray = new ConstantUnion[objectSize];
</span><span class="cx"> for (size_t i = 0; i < objectSize; ++i)
</span><ins>+ {
</ins><span class="cx"> rightUnionArray[i] = *node->getUnionArrayPointer();
</span><ins>+ }
</ins><span class="cx"> returnType = getType();
</span><del>- } else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1) {
</del><ins>+ }
+ else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1)
+ {
</ins><span class="cx"> // for a case like float f = vec4(2,3,4,5) + 1.2;
</span><span class="cx"> unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
</span><span class="cx"> for (size_t i = 0; i < constantNode->getType().getObjectSize(); ++i)
</span><ins>+ {
</ins><span class="cx"> unionArray[i] = *getUnionArrayPointer();
</span><ins>+ }
</ins><span class="cx"> returnType = node->getType();
</span><span class="cx"> objectSize = constantNode->getType().getObjectSize();
</span><span class="cx"> }
</span><span class="lines">@@ -1154,261 +1365,357 @@
</span><span class="cx">
</span><span class="cx"> bool boolNodeFlag = false;
</span><span class="cx"> switch(op) {
</span><del>- case EOpAdd:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] + rightUnionArray[i];
- }
- break;
- case EOpSub:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] - rightUnionArray[i];
- }
- break;
</del><ins>+ case EOpAdd:
+ tempConstArray = new ConstantUnion[objectSize];
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] + rightUnionArray[i];
+ }
+ break;
+ case EOpSub:
+ tempConstArray = new ConstantUnion[objectSize];
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] - rightUnionArray[i];
+ }
+ break;
</ins><span class="cx">
</span><del>- case EOpMul:
- case EOpVectorTimesScalar:
- case EOpMatrixTimesScalar:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] * rightUnionArray[i];
- }
- break;
- case EOpMatrixTimesMatrix:
- if (getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat) {
</del><ins>+ case EOpMul:
+ case EOpVectorTimesScalar:
+ case EOpMatrixTimesScalar:
+ tempConstArray = new ConstantUnion[objectSize];
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ tempConstArray[i] = unionArray[i] * rightUnionArray[i];
+ }
+ break;
+
+ case EOpMatrixTimesMatrix:
+ {
+ if (getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat)
+ {
</ins><span class="cx"> infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for matrix multiply");
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><del>- {// support MSVC++6.0
- int size = getNominalSize();
- tempConstArray = new ConstantUnion[size*size];
- for (int row = 0; row < size; row++) {
- for (int column = 0; column < size; column++) {
- tempConstArray[size * column + row].setFConst(0.0f);
- for (int i = 0; i < size; i++) {
- tempConstArray[size * column + row].setFConst(tempConstArray[size * column + row].getFConst() + unionArray[i * size + row].getFConst() * (rightUnionArray[column * size + i].getFConst()));
- }
</del><ins>+
+ const int leftCols = getCols();
+ const int leftRows = getRows();
+ const int rightCols = constantNode->getType().getCols();
+ const int rightRows = constantNode->getType().getRows();
+ const int resultCols = rightCols;
+ const int resultRows = leftRows;
+
+ tempConstArray = new ConstantUnion[resultCols*resultRows];
+ for (int row = 0; row < resultRows; row++)
+ {
+ for (int column = 0; column < resultCols; column++)
+ {
+ tempConstArray[resultRows * column + row].setFConst(0.0f);
+ for (int i = 0; i < leftCols; i++)
+ {
+ tempConstArray[resultRows * column + row].setFConst(tempConstArray[resultRows * column + row].getFConst() + unionArray[i * leftRows + row].getFConst() * (rightUnionArray[column * rightRows + i].getFConst()));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- break;
- case EOpDiv:
</del><ins>+
+ // update return type for matrix product
+ returnType.setPrimarySize(resultCols);
+ returnType.setSecondarySize(resultRows);
+ }
+ break;
+
+ case EOpDiv:
+ {
</ins><span class="cx"> tempConstArray = new ConstantUnion[objectSize];
</span><del>- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++) {
- switch (getType().getBasicType()) {
- case EbtFloat:
- if (rightUnionArray[i] == 0.0f) {
- infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
- tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
- } else
- tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
- break;
</del><ins>+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ if (rightUnionArray[i] == 0.0f)
+ {
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
+ tempConstArray[i].setFConst(unionArray[i].getFConst() < 0 ? -FLT_MAX : FLT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
+ }
+ break;
</ins><span class="cx">
</span><del>- case EbtInt:
- if (rightUnionArray[i] == 0) {
- infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
- tempConstArray[i].setIConst(INT_MAX);
- } else
- tempConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
- break;
- default:
- infoSink.info.message(EPrefixInternalError, getLine(), "Constant folding cannot be done for \"/\"");
- return 0;
</del><ins>+ case EbtInt:
+ if (rightUnionArray[i] == 0)
+ {
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
+ tempConstArray[i].setIConst(INT_MAX);
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ tempConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
+ }
+ break;
+
+ case EbtUInt:
+ if (rightUnionArray[i] == 0)
+ {
+ infoSink.info.message(EPrefixWarning, getLine(), "Divide by zero error during constant folding");
+ tempConstArray[i].setUConst(UINT_MAX);
+ }
+ else
+ {
+ tempConstArray[i].setUConst(unionArray[i].getUConst() / rightUnionArray[i].getUConst());
+ }
+ break;
+
+ default:
+ infoSink.info.message(EPrefixInternalError, getLine(), "Constant folding cannot be done for \"/\"");
+ return 0;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ }
+ break;
</ins><span class="cx">
</span><del>- case EOpMatrixTimesVector:
- if (node->getBasicType() != EbtFloat) {
</del><ins>+ case EOpMatrixTimesVector:
+ {
+ if (node->getBasicType() != EbtFloat)
+ {
</ins><span class="cx"> infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for matrix times vector");
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><del>- tempConstArray = new ConstantUnion[getNominalSize()];
</del><span class="cx">
</span><del>- {// support MSVC++6.0
- for (int size = getNominalSize(), i = 0; i < size; i++) {
- tempConstArray[i].setFConst(0.0f);
- for (int j = 0; j < size; j++) {
- tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j*size + i].getFConst()) * rightUnionArray[j].getFConst()));
- }
</del><ins>+ const int matrixCols = getCols();
+ const int matrixRows = getRows();
+
+ tempConstArray = new ConstantUnion[matrixRows];
+
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ tempConstArray[matrixRow].setFConst(0.0f);
+ for (int col = 0; col < matrixCols; col++)
+ {
+ tempConstArray[matrixRow].setFConst(tempConstArray[matrixRow].getFConst() + ((unionArray[col * matrixRows + matrixRow].getFConst()) * rightUnionArray[col].getFConst()));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- tempNode = new TIntermConstantUnion(tempConstArray, node->getType());
</del><ins>+ returnType = node->getType();
+ returnType.setPrimarySize(matrixRows);
+
+ tempNode = new TIntermConstantUnion(tempConstArray, returnType);
</ins><span class="cx"> tempNode->setLine(getLine());
</span><span class="cx">
</span><span class="cx"> return tempNode;
</span><ins>+ }
</ins><span class="cx">
</span><del>- case EOpVectorTimesMatrix:
- if (getType().getBasicType() != EbtFloat) {
</del><ins>+ case EOpVectorTimesMatrix:
+ {
+ if (getType().getBasicType() != EbtFloat)
+ {
</ins><span class="cx"> infoSink.info.message(EPrefixInternalError, getLine(), "Constant Folding cannot be done for vector times matrix");
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- tempConstArray = new ConstantUnion[getNominalSize()];
- {// support MSVC++6.0
- for (int size = getNominalSize(), i = 0; i < size; i++) {
- tempConstArray[i].setFConst(0.0f);
- for (int j = 0; j < size; j++) {
- tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j].getFConst()) * rightUnionArray[i*size + j].getFConst()));
- }
</del><ins>+ const int matrixCols = constantNode->getType().getCols();
+ const int matrixRows = constantNode->getType().getRows();
+
+ tempConstArray = new ConstantUnion[matrixCols];
+
+ for (int matrixCol = 0; matrixCol < matrixCols; matrixCol++)
+ {
+ tempConstArray[matrixCol].setFConst(0.0f);
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ tempConstArray[matrixCol].setFConst(tempConstArray[matrixCol].getFConst() + ((unionArray[matrixRow].getFConst()) * rightUnionArray[matrixCol * matrixRows + matrixRow].getFConst()));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- break;
</del><span class="cx">
</span><del>- case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
</del><ins>+ returnType.setPrimarySize(matrixCols);
+ }
+ break;
+
+ case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
+ {
</ins><span class="cx"> tempConstArray = new ConstantUnion[objectSize];
</span><del>- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] && rightUnionArray[i];
</del><ins>+ for (size_t i = 0; i < objectSize; i++)
+ {
+ tempConstArray[i] = unionArray[i] && rightUnionArray[i];
</ins><span class="cx"> }
</span><del>- break;
</del><ins>+ }
+ break;
</ins><span class="cx">
</span><del>- case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
</del><ins>+ case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
+ {
</ins><span class="cx"> tempConstArray = new ConstantUnion[objectSize];
</span><del>- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] || rightUnionArray[i];
</del><ins>+ for (size_t i = 0; i < objectSize; i++)
+ {
+ tempConstArray[i] = unionArray[i] || rightUnionArray[i];
</ins><span class="cx"> }
</span><del>- break;
</del><ins>+ }
+ break;
</ins><span class="cx">
</span><del>- case EOpLogicalXor:
</del><ins>+ case EOpLogicalXor:
+ {
</ins><span class="cx"> tempConstArray = new ConstantUnion[objectSize];
</span><del>- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- switch (getType().getBasicType()) {
- case EbtBool: tempConstArray[i].setBConst((unionArray[i] == rightUnionArray[i]) ? false : true); break;
- default: assert(false && "Default missing");
</del><ins>+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch (getType().getBasicType())
+ {
+ case EbtBool:
+ tempConstArray[i].setBConst((unionArray[i] == rightUnionArray[i]) ? false : true);
+ break;
+ default:
+ UNREACHABLE();
+ break;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ }
+ break;
</ins><span class="cx">
</span><del>- case EOpLessThan:
</del><ins>+ case EOpLessThan:
+ assert(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray < *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+
+ case EOpGreaterThan:
+ assert(objectSize == 1);
+ tempConstArray = new ConstantUnion[1];
+ tempConstArray->setBConst(*unionArray > *rightUnionArray);
+ returnType = TType(EbtBool, EbpUndefined, EvqConst);
+ break;
+
+ case EOpLessThanEqual:
+ {
</ins><span class="cx"> assert(objectSize == 1);
</span><ins>+ ConstantUnion constant;
+ constant.setBConst(*unionArray > *rightUnionArray);
</ins><span class="cx"> tempConstArray = new ConstantUnion[1];
</span><del>- tempConstArray->setBConst(*unionArray < *rightUnionArray);
</del><ins>+ tempConstArray->setBConst(!constant.getBConst());
</ins><span class="cx"> returnType = TType(EbtBool, EbpUndefined, EvqConst);
</span><span class="cx"> break;
</span><del>- case EOpGreaterThan:
</del><ins>+ }
+
+ case EOpGreaterThanEqual:
+ {
</ins><span class="cx"> assert(objectSize == 1);
</span><ins>+ ConstantUnion constant;
+ constant.setBConst(*unionArray < *rightUnionArray);
</ins><span class="cx"> tempConstArray = new ConstantUnion[1];
</span><del>- tempConstArray->setBConst(*unionArray > *rightUnionArray);
</del><ins>+ tempConstArray->setBConst(!constant.getBConst());
</ins><span class="cx"> returnType = TType(EbtBool, EbpUndefined, EvqConst);
</span><span class="cx"> break;
</span><del>- case EOpLessThanEqual:
</del><ins>+ }
+
+ case EOpEqual:
+ if (getType().getBasicType() == EbtStruct)
+ {
+ if (!CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ boolNodeFlag = true;
+ }
+ else
+ {
+ for (size_t i = 0; i < objectSize; i++)
</ins><span class="cx"> {
</span><del>- assert(objectSize == 1);
- ConstantUnion constant;
- constant.setBConst(*unionArray > *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(!constant.getBConst());
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
- }
- case EOpGreaterThanEqual:
- {
- assert(objectSize == 1);
- ConstantUnion constant;
- constant.setBConst(*unionArray < *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
- tempConstArray->setBConst(!constant.getBConst());
- returnType = TType(EbtBool, EbpUndefined, EvqConst);
- break;
- }
-
- case EOpEqual:
- if (getType().getBasicType() == EbtStruct) {
- if (!CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
</del><ins>+ if (unionArray[i] != rightUnionArray[i])
+ {
</ins><span class="cx"> boolNodeFlag = true;
</span><del>- } else {
- for (size_t i = 0; i < objectSize; i++) {
- if (unionArray[i] != rightUnionArray[i]) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
</del><ins>+ break; // break out of for loop
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ }
</ins><span class="cx">
</span><del>- tempConstArray = new ConstantUnion[1];
- if (!boolNodeFlag) {
- tempConstArray->setBConst(true);
- }
- else {
- tempConstArray->setBConst(false);
- }
</del><ins>+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag)
+ {
+ tempConstArray->setBConst(true);
+ }
+ else
+ {
+ tempConstArray->setBConst(false);
+ }
</ins><span class="cx">
</span><del>- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
- tempNode->setLine(getLine());
</del><ins>+ tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
</ins><span class="cx">
</span><del>- return tempNode;
</del><ins>+ return tempNode;
</ins><span class="cx">
</span><del>- case EOpNotEqual:
- if (getType().getBasicType() == EbtStruct) {
- if (CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
</del><ins>+ case EOpNotEqual:
+ if (getType().getBasicType() == EbtStruct)
+ {
+ if (CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))
+ boolNodeFlag = true;
+ }
+ else
+ {
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (unionArray[i] == rightUnionArray[i])
+ {
</ins><span class="cx"> boolNodeFlag = true;
</span><del>- } else {
- for (size_t i = 0; i < objectSize; i++) {
- if (unionArray[i] == rightUnionArray[i]) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
</del><ins>+ break; // break out of for loop
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ }
</ins><span class="cx">
</span><del>- tempConstArray = new ConstantUnion[1];
- if (!boolNodeFlag) {
- tempConstArray->setBConst(true);
- }
- else {
- tempConstArray->setBConst(false);
- }
</del><ins>+ tempConstArray = new ConstantUnion[1];
+ if (!boolNodeFlag)
+ {
+ tempConstArray->setBConst(true);
+ }
+ else
+ {
+ tempConstArray->setBConst(false);
+ }
</ins><span class="cx">
</span><del>- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
- tempNode->setLine(getLine());
</del><ins>+ tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+ tempNode->setLine(getLine());
</ins><span class="cx">
</span><del>- return tempNode;
</del><ins>+ return tempNode;
</ins><span class="cx">
</span><del>- default:
- infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operator for constant folding");
- return 0;
</del><ins>+ default:
+ infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operator for constant folding");
+ return 0;
</ins><span class="cx"> }
</span><span class="cx"> tempNode = new TIntermConstantUnion(tempConstArray, returnType);
</span><span class="cx"> tempNode->setLine(getLine());
</span><span class="cx">
</span><span class="cx"> return tempNode;
</span><del>- } else {
</del><ins>+ }
+ else
+ {
</ins><span class="cx"> //
</span><span class="cx"> // Do unary operations
</span><span class="cx"> //
</span><span class="cx"> TIntermConstantUnion *newNode = 0;
</span><span class="cx"> ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
</span><del>- for (size_t i = 0; i < 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;
- default:
- infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
- 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(), "Unary operation not folded into constant");
- return 0;
- }
- break;
- default:
</del><ins>+ for (size_t i = 0; i < 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<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
+ default:
+ infoSink.info.message(EPrefixInternalError, getLine(), "Unary operation not folded into constant");
</ins><span class="cx"> return 0;
</span><ins>+ }
+ 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(), "Unary operation not folded into constant");
+ return 0;
+ }
+ break;
+
+ default:
+ return 0;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> newNode = new TIntermConstantUnion(tempConstArray, getType());
</span><span class="lines">@@ -1423,7 +1730,7 @@
</span><span class="cx">
</span><span class="cx"> ConstantUnion *leftUnionArray = new ConstantUnion[size];
</span><span class="cx">
</span><del>- for (size_t i = 0; i < size; i++) {
</del><ins>+ for (size_t i=0; i < size; i++) {
</ins><span class="cx">
</span><span class="cx"> switch (promoteTo) {
</span><span class="cx"> case EbtFloat:
</span><span class="lines">@@ -1431,6 +1738,9 @@
</span><span class="cx"> case EbtInt:
</span><span class="cx"> leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i)));
</span><span class="cx"> break;
</span><ins>+ case EbtUInt:
+ leftUnionArray[i].setFConst(static_cast<float>(node->getUConst(i)));
+ break;
</ins><span class="cx"> case EbtBool:
</span><span class="cx"> leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i)));
</span><span class="cx"> break;
</span><span class="lines">@@ -1447,6 +1757,9 @@
</span><span class="cx"> case EbtInt:
</span><span class="cx"> leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i)));
</span><span class="cx"> break;
</span><ins>+ case EbtUInt:
+ leftUnionArray[i].setIConst(static_cast<int>(node->getUConst(i)));
+ break;
</ins><span class="cx"> case EbtBool:
</span><span class="cx"> leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i)));
</span><span class="cx"> break;
</span><span class="lines">@@ -1458,11 +1771,33 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+ case EbtUInt:
+ switch (node->getType().getBasicType()) {
+ case EbtInt:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getIConst(i)));
+ break;
+ case EbtUInt:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getUConst(i)));
+ break;
+ case EbtBool:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getBConst(i)));
+ break;
+ case EbtFloat:
+ leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getFConst(i)));
+ break;
+ default:
+ infoSink.info.message(EPrefixInternalError, node->getLine(), "Cannot promote");
+ return 0;
+ }
+ break;
</ins><span class="cx"> case EbtBool:
</span><span class="cx"> switch (node->getType().getBasicType()) {
</span><span class="cx"> case EbtInt:
</span><span class="cx"> leftUnionArray[i].setBConst(node->getIConst(i) != 0);
</span><span class="cx"> break;
</span><ins>+ case EbtUInt:
+ leftUnionArray[i].setBConst(node->getUConst(i) != 0);
+ break;
</ins><span class="cx"> case EbtBool:
</span><span class="cx"> leftUnionArray[i].setBConst(node->getBConst(i));
</span><span class="cx"> break;
</span><span class="lines">@@ -1484,7 +1819,7 @@
</span><span class="cx">
</span><span class="cx"> const TType& t = node->getType();
</span><span class="cx">
</span><del>- return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());
</del><ins>+ return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.getSecondarySize(), t.isArray()), node->getLine());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // static
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorLoopInfocpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,211 @@
</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 "compiler/translator/LoopInfo.h"
+
+namespace
+{
+
+int EvaluateIntConstant(TIntermConstantUnion *node)
+{
+ ASSERT(node && node->getUnionArrayPointer());
+ return node->getIConst(0);
+}
+
+int GetLoopIntIncrement(TIntermLoop *node)
+{
+ TIntermNode *expr = node->getExpression();
+ // for expression has one of the following forms:
+ // loop_index++
+ // loop_index--
+ // loop_index += constant_expression
+ // loop_index -= constant_expression
+ // ++loop_index
+ // --loop_index
+ // The last two forms are not specified in the spec, but I am assuming
+ // its an oversight.
+ TIntermUnary *unOp = expr->getAsUnaryNode();
+ TIntermBinary *binOp = unOp ? NULL : expr->getAsBinaryNode();
+
+ TOperator op = EOpNull;
+ TIntermConstantUnion *incrementNode = NULL;
+ if (unOp)
+ {
+ op = unOp->getOp();
+ }
+ else if (binOp)
+ {
+ op = binOp->getOp();
+ ASSERT(binOp->getRight());
+ incrementNode = binOp->getRight()->getAsConstantUnion();
+ ASSERT(incrementNode);
+ }
+
+ int increment = 0;
+ // The operator is one of: ++ -- += -=.
+ switch (op)
+ {
+ case EOpPostIncrement:
+ case EOpPreIncrement:
+ ASSERT(unOp && !binOp);
+ increment = 1;
+ break;
+ case EOpPostDecrement:
+ case EOpPreDecrement:
+ ASSERT(unOp && !binOp);
+ increment = -1;
+ break;
+ case EOpAddAssign:
+ ASSERT(!unOp && binOp);
+ increment = EvaluateIntConstant(incrementNode);
+ break;
+ case EOpSubAssign:
+ ASSERT(!unOp && binOp);
+ increment = - EvaluateIntConstant(incrementNode);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return increment;
+}
+
+} // namespace anonymous
+
+TLoopIndexInfo::TLoopIndexInfo()
+ : mId(-1),
+ mType(EbtVoid),
+ mInitValue(0),
+ mStopValue(0),
+ mIncrementValue(0),
+ mOp(EOpNull),
+ mCurrentValue(0)
+{
+}
+
+void TLoopIndexInfo::fillInfo(TIntermLoop *node)
+{
+ if (node == NULL)
+ return;
+
+ // Here we assume all the operations are valid, because the loop node is
+ // already validated in ValidateLimitations.
+ TIntermSequence &declSeq =
+ node->getInit()->getAsAggregate()->getSequence();
+ TIntermBinary *declInit = declSeq[0]->getAsBinaryNode();
+ TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
+
+ mId = symbol->getId();
+ mType = symbol->getBasicType();
+
+ if (mType == EbtInt)
+ {
+ TIntermConstantUnion* initNode = declInit->getRight()->getAsConstantUnion();
+ mInitValue = EvaluateIntConstant(initNode);
+ mCurrentValue = mInitValue;
+ mIncrementValue = GetLoopIntIncrement(node);
+
+ TIntermBinary* binOp = node->getCondition()->getAsBinaryNode();
+ mStopValue = EvaluateIntConstant(
+ binOp->getRight()->getAsConstantUnion());
+ mOp = binOp->getOp();
+ }
+}
+
+bool TLoopIndexInfo::satisfiesLoopCondition() const
+{
+ // Relational operator is one of: > >= < <= == or !=.
+ switch (mOp)
+ {
+ case EOpEqual:
+ return (mCurrentValue == mStopValue);
+ case EOpNotEqual:
+ return (mCurrentValue != mStopValue);
+ case EOpLessThan:
+ return (mCurrentValue < mStopValue);
+ case EOpGreaterThan:
+ return (mCurrentValue > mStopValue);
+ case EOpLessThanEqual:
+ return (mCurrentValue <= mStopValue);
+ case EOpGreaterThanEqual:
+ return (mCurrentValue >= mStopValue);
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+TLoopInfo::TLoopInfo()
+ : loop(NULL)
+{
+}
+
+TLoopInfo::TLoopInfo(TIntermLoop *node)
+ : loop(node)
+{
+ index.fillInfo(node);
+}
+
+TIntermLoop *TLoopStack::findLoop(TIntermSymbol *symbol)
+{
+ if (!symbol)
+ return NULL;
+ for (iterator iter = begin(); iter != end(); ++iter)
+ {
+ if (iter->index.getId() == symbol->getId())
+ return iter->loop;
+ }
+ return NULL;
+}
+
+TLoopIndexInfo *TLoopStack::getIndexInfo(TIntermSymbol *symbol)
+{
+ if (!symbol)
+ return NULL;
+ for (iterator iter = begin(); iter != end(); ++iter)
+ {
+ if (iter->index.getId() == symbol->getId())
+ return &(iter->index);
+ }
+ return NULL;
+}
+
+void TLoopStack::step()
+{
+ ASSERT(!empty());
+ rbegin()->index.step();
+}
+
+bool TLoopStack::satisfiesLoopCondition()
+{
+ ASSERT(!empty());
+ return rbegin()->index.satisfiesLoopCondition();
+}
+
+bool TLoopStack::needsToReplaceSymbolWithValue(TIntermSymbol *symbol)
+{
+ TIntermLoop *loop = findLoop(symbol);
+ return loop && loop->getUnrollFlag();
+}
+
+int TLoopStack::getLoopIndexValue(TIntermSymbol *symbol)
+{
+ TLoopIndexInfo *info = getIndexInfo(symbol);
+ ASSERT(info);
+ return info->getCurrentValue();
+}
+
+void TLoopStack::push(TIntermLoop *loop)
+{
+ TLoopInfo info(loop);
+ push_back(info);
+}
+
+void TLoopStack::pop()
+{
+ pop_back();
+}
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorLoopInfoh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,80 @@
</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_LOOP_INFO_H_
+#define COMPILER_TRANSLATOR_LOOP_INFO_H_
+
+#include "compiler/translator/intermediate.h"
+
+class TLoopIndexInfo
+{
+ public:
+ TLoopIndexInfo();
+
+ // If type is EbtInt, fill all fields of the structure with info
+ // extracted from a loop node.
+ // If type is not EbtInt, only fill id and type.
+ void fillInfo(TIntermLoop *node);
+
+ int getId() const { return mId; }
+ void setId(int id) { mId = id; }
+ TBasicType getType() const { return mType; }
+ void setType(TBasicType type) { mType = type; }
+ int getCurrentValue() const { return mCurrentValue; }
+
+ void step() { mCurrentValue += mIncrementValue; }
+
+ // Check if the current value satisfies the loop condition.
+ bool satisfiesLoopCondition() const;
+
+ private:
+ int mId;
+ TBasicType mType; // Either EbtInt or EbtFloat
+
+ // Below fields are only valid if the index's type is int.
+ int mInitValue;
+ int mStopValue;
+ int mIncrementValue;
+ TOperator mOp;
+ int mCurrentValue;
+};
+
+struct TLoopInfo
+{
+ TLoopIndexInfo index;
+ TIntermLoop *loop;
+
+ TLoopInfo();
+ TLoopInfo(TIntermLoop *node);
+};
+
+class TLoopStack : public TVector<TLoopInfo>
+{
+ public:
+ // Search loop stack for a loop whose index matches the input symbol.
+ TIntermLoop *findLoop(TIntermSymbol *symbol);
+
+ // Find the loop index info in the loop stack by the input symbol.
+ TLoopIndexInfo *getIndexInfo(TIntermSymbol *symbol);
+
+ // Update the currentValue for the next loop iteration.
+ void step();
+
+ // Return false if loop condition is no longer satisfied.
+ bool satisfiesLoopCondition();
+
+ // Check if the symbol is the index of a loop that's unrolled.
+ bool needsToReplaceSymbolWithValue(TIntermSymbol *symbol);
+
+ // Return the current value of a given loop index symbol.
+ int getLoopIndexValue(TIntermSymbol *symbol);
+
+ void push(TIntermLoop *info);
+ void pop();
+};
+
+#endif // COMPILER_TRANSLATOR_LOOP_INDEX_H_
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorMapLongVariableNamescpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,115 +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.
-//
-
-#include "compiler/translator/MapLongVariableNames.h"
-
-namespace {
-
-TString mapLongName(size_t id, const TString& name, bool isGlobal)
-{
- ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
- TStringStream stream;
- stream << "webgl_";
- if (isGlobal)
- stream << "g";
- stream << id;
- if (name[0] != '_')
- stream << "_";
- stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size());
- return stream.str();
-}
-
-LongNameMap* gLongNameMapInstance = NULL;
-
-} // anonymous namespace
-
-LongNameMap::LongNameMap()
- : refCount(0)
-{
-}
-
-LongNameMap::~LongNameMap()
-{
-}
-
-// static
-LongNameMap* LongNameMap::GetInstance()
-{
- if (gLongNameMapInstance == NULL)
- gLongNameMapInstance = new LongNameMap;
- gLongNameMapInstance->refCount++;
- return gLongNameMapInstance;
-}
-
-void LongNameMap::Release()
-{
- ASSERT(gLongNameMapInstance == this);
- ASSERT(refCount > 0);
- refCount--;
- if (refCount == 0) {
- delete gLongNameMapInstance;
- gLongNameMapInstance = NULL;
- }
-}
-
-const char* LongNameMap::Find(const char* originalName) const
-{
- std::map<std::string, std::string>::const_iterator it = mLongNameMap.find(
- originalName);
- if (it != mLongNameMap.end())
- return (*it).second.c_str();
- return NULL;
-}
-
-void LongNameMap::Insert(const char* originalName, const char* mappedName)
-{
- mLongNameMap.insert(std::map<std::string, std::string>::value_type(
- originalName, mappedName));
-}
-
-size_t LongNameMap::Size() const
-{
- return mLongNameMap.size();
-}
-
-MapLongVariableNames::MapLongVariableNames(LongNameMap* globalMap)
-{
- ASSERT(globalMap);
- mGlobalMap = globalMap;
-}
-
-void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
-{
- ASSERT(symbol != NULL);
- if (symbol->getSymbol().size() > MAX_SHORTENED_IDENTIFIER_SIZE) {
- switch (symbol->getQualifier()) {
- case EvqVaryingIn:
- case EvqVaryingOut:
- case EvqInvariantVaryingIn:
- case EvqInvariantVaryingOut:
- case EvqUniform:
- symbol->setSymbol(
- mapGlobalLongName(symbol->getSymbol()));
- break;
- default:
- symbol->setSymbol(
- mapLongName(symbol->getId(), symbol->getSymbol(), false));
- break;
- };
- }
-}
-
-TString MapLongVariableNames::mapGlobalLongName(const TString& name)
-{
- ASSERT(mGlobalMap);
- const char* mappedName = mGlobalMap->Find(name.c_str());
- if (mappedName != NULL)
- return mappedName;
- size_t id = mGlobalMap->Size();
- TString rt = mapLongName(id, name, true);
- mGlobalMap->Insert(name.c_str(), rt.c_str());
- return rt;
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorMapLongVariableNamesh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MapLongVariableNames.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,58 +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.
-//
-
-#ifndef COMPILER_MAP_LONG_VARIABLE_NAMES_H_
-#define COMPILER_MAP_LONG_VARIABLE_NAMES_H_
-
-#include "GLSLANG/ShaderLang.h"
-
-#include "compiler/translator/intermediate.h"
-#include "compiler/translator/VariableInfo.h"
-
-// This size does not include '\0' in the end.
-#define MAX_SHORTENED_IDENTIFIER_SIZE 32
-
-// This is a ref-counted singleton. GetInstance() returns a pointer to the
-// singleton, and after use, call Release(). GetInstance() and Release() should
-// be paired.
-class LongNameMap {
-public:
- static LongNameMap* GetInstance();
- void Release();
-
- // Return the mapped name if <originalName, mappedName> is in the map;
- // otherwise, return NULL.
- const char* Find(const char* originalName) const;
-
- // Insert a pair into the map.
- void Insert(const char* originalName, const char* mappedName);
-
- // Return the number of entries in the map.
- size_t Size() const;
-
-private:
- LongNameMap();
- ~LongNameMap();
-
- size_t refCount;
- std::map<std::string, std::string> mLongNameMap;
-};
-
-// Traverses intermediate tree to map attributes and uniforms names that are
-// longer than MAX_SHORTENED_IDENTIFIER_SIZE to MAX_SHORTENED_IDENTIFIER_SIZE.
-class MapLongVariableNames : public TIntermTraverser {
-public:
- MapLongVariableNames(LongNameMap* globalMap);
-
- virtual void visitSymbol(TIntermSymbol*);
-
-private:
- TString mapGlobalLongName(const TString& name);
-
- LongNameMap* mGlobalMap;
-};
-
-#endif // COMPILER_MAP_LONG_VARIABLE_NAMES_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputESSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -10,8 +10,9 @@
</span><span class="cx"> ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx"> ShHashFunction64 hashFunction,
</span><span class="cx"> NameMap& nameMap,
</span><del>- TSymbolTable& symbolTable)
- : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
</del><ins>+ TSymbolTable& symbolTable,
+ int shaderVersion)
+ : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
</ins><span class="cx"> {
</span><span class="cx"> }
</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 (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -16,7 +16,8 @@
</span><span class="cx"> ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx"> ShHashFunction64 hashFunction,
</span><span class="cx"> NameMap& nameMap,
</span><del>- TSymbolTable& symbolTable);
</del><ins>+ TSymbolTable& symbolTable,
+ int shaderVersion);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual bool writeVariablePrecision(TPrecision precision);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -10,8 +10,9 @@
</span><span class="cx"> ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx"> ShHashFunction64 hashFunction,
</span><span class="cx"> NameMap& nameMap,
</span><del>- TSymbolTable& symbolTable)
- : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable)
</del><ins>+ TSymbolTable& symbolTable,
+ int shaderVersion)
+ : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -33,3 +34,24 @@
</span><span class="cx"> TOutputGLSLBase::visitSymbol(node);
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+TString TOutputGLSL::translateTextureFunction(TString& name)
+{
+ static const char *simpleRename[] = {
+ "texture2DLodEXT", "texture2DLod",
+ "texture2DProjLodEXT", "texture2DProjLod",
+ "textureCubeLodEXT", "textureCubeLod",
+ "texture2DGradEXT", "texture2DGradARB",
+ "texture2DProjGradEXT", "texture2DProjGradARB",
+ "textureCubeGradEXT", "textureCubeGradARB",
+ NULL, NULL
+ };
+
+ for (int i = 0; simpleRename[i] != NULL; i += 2) {
+ if (name == simpleRename[i]) {
+ return simpleRename[i+1];
+ }
+ }
+
+ return name;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -16,11 +16,13 @@
</span><span class="cx"> ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx"> ShHashFunction64 hashFunction,
</span><span class="cx"> NameMap& nameMap,
</span><del>- TSymbolTable& symbolTable);
</del><ins>+ TSymbolTable& symbolTable,
+ int shaderVersion);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual bool writeVariablePrecision(TPrecision);
</span><span class="cx"> virtual void visitSymbol(TIntermSymbol* node);
</span><ins>+ virtual TString translateTextureFunction(TString& name);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -43,14 +43,16 @@
</span><span class="cx"> ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx"> ShHashFunction64 hashFunction,
</span><span class="cx"> NameMap& nameMap,
</span><del>- TSymbolTable& symbolTable)
</del><ins>+ TSymbolTable& symbolTable,
+ int shaderVersion)
</ins><span class="cx"> : TIntermTraverser(true, true, true),
</span><span class="cx"> mObjSink(objSink),
</span><span class="cx"> mDeclaringVariables(false),
</span><span class="cx"> mClampingStrategy(clampingStrategy),
</span><span class="cx"> mHashFunction(hashFunction),
</span><span class="cx"> mNameMap(nameMap),
</span><del>- mSymbolTable(symbolTable)
</del><ins>+ mSymbolTable(symbolTable),
+ mShaderVersion(shaderVersion)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -159,8 +161,8 @@
</span><span class="cx"> void TOutputGLSLBase::visitSymbol(TIntermSymbol* node)
</span><span class="cx"> {
</span><span class="cx"> TInfoSinkBase& out = objSink();
</span><del>- if (mLoopUnroll.NeedsToReplaceSymbolWithValue(node))
- out << mLoopUnroll.GetLoopIndexValue(node);
</del><ins>+ if (mLoopUnrollStack.needsToReplaceSymbolWithValue(node))
+ out << mLoopUnrollStack.getLoopIndexValue(node);
</ins><span class="cx"> else
</span><span class="cx"> out << hashVariableName(node->getSymbol());
</span><span class="cx">
</span><span class="lines">@@ -256,7 +258,7 @@
</span><span class="cx"> const TField* field = structure->fields()[index->getIConst(0)];
</span><span class="cx">
</span><span class="cx"> TString fieldName = field->name();
</span><del>- if (!mSymbolTable.findBuiltIn(structure->name()))
</del><ins>+ if (!mSymbolTable.findBuiltIn(structure->name(), mShaderVersion))
</ins><span class="cx"> fieldName = hashName(fieldName);
</span><span class="cx">
</span><span class="cx"> out << fieldName;
</span><span class="lines">@@ -643,7 +645,8 @@
</span><span class="cx"> TLoopType loopType = node->getType();
</span><span class="cx"> if (loopType == ELoopFor) // for loop
</span><span class="cx"> {
</span><del>- if (!node->getUnrollFlag()) {
</del><ins>+ if (!node->getUnrollFlag())
+ {
</ins><span class="cx"> out << "for (";
</span><span class="cx"> if (node->getInit())
</span><span class="cx"> node->getInit()->traverse(this);
</span><span class="lines">@@ -657,6 +660,18 @@
</span><span class="cx"> node->getExpression()->traverse(this);
</span><span class="cx"> out << ")\n";
</span><span class="cx"> }
</span><ins>+ else
+ {
+ // Need to put a one-iteration loop here to handle break.
+ TIntermSequence &declSeq =
+ node->getInit()->getAsAggregate()->getSequence();
+ TIntermSymbol *indexSymbol =
+ declSeq[0]->getAsBinaryNode()->getLeft()->getAsSymbolNode();
+ TString name = hashVariableName(indexSymbol->getSymbol());
+ out << "for (int " << name << " = 0; "
+ << name << " < 1; "
+ << "++" << name << ")\n";
+ }
</ins><span class="cx"> }
</span><span class="cx"> else if (loopType == ELoopWhile) // while loop
</span><span class="cx"> {
</span><span class="lines">@@ -674,15 +689,15 @@
</span><span class="cx"> // Loop body.
</span><span class="cx"> if (node->getUnrollFlag())
</span><span class="cx"> {
</span><del>- TLoopIndexInfo indexInfo;
- mLoopUnroll.FillLoopIndexInfo(node, indexInfo);
- mLoopUnroll.Push(indexInfo);
- while (mLoopUnroll.SatisfiesLoopCondition())
</del><ins>+ out << "{\n";
+ mLoopUnrollStack.push(node);
+ while (mLoopUnrollStack.satisfiesLoopCondition())
</ins><span class="cx"> {
</span><span class="cx"> visitCodeBlock(node->getBody());
</span><del>- mLoopUnroll.Step();
</del><ins>+ mLoopUnrollStack.step();
</ins><span class="cx"> }
</span><del>- mLoopUnroll.Pop();
</del><ins>+ mLoopUnrollStack.pop();
+ out << "}\n";
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -777,7 +792,7 @@
</span><span class="cx">
</span><span class="cx"> TString TOutputGLSLBase::hashVariableName(const TString& name)
</span><span class="cx"> {
</span><del>- if (mSymbolTable.findBuiltIn(name) != NULL)
</del><ins>+ if (mSymbolTable.findBuiltIn(name, mShaderVersion) != NULL)
</ins><span class="cx"> return name;
</span><span class="cx"> return hashName(name);
</span><span class="cx"> }
</span><span class="lines">@@ -785,8 +800,10 @@
</span><span class="cx"> TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name)
</span><span class="cx"> {
</span><span class="cx"> TString name = TFunction::unmangleName(mangled_name);
</span><del>- if (mSymbolTable.findBuiltIn(mangled_name) != NULL || name == "main")
- return name;
</del><ins>+ if (mSymbolTable.findBuiltIn(mangled_name, mShaderVersion) != NULL || name == "main")
+ {
+ return translateTextureFunction(name);
+ }
</ins><span class="cx"> return hashName(name);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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,8 @@
</span><span class="cx">
</span><span class="cx"> #include <set>
</span><span class="cx">
</span><del>-#include "compiler/translator/ForLoopUnroll.h"
</del><span class="cx"> #include "compiler/translator/intermediate.h"
</span><ins>+#include "compiler/translator/LoopInfo.h"
</ins><span class="cx"> #include "compiler/translator/ParseContext.h"
</span><span class="cx">
</span><span class="cx"> class TOutputGLSLBase : public TIntermTraverser
</span><span class="lines">@@ -20,7 +20,8 @@
</span><span class="cx"> ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx"> ShHashFunction64 hashFunction,
</span><span class="cx"> NameMap& nameMap,
</span><del>- TSymbolTable& symbolTable);
</del><ins>+ TSymbolTable& symbolTable,
+ int shaderVersion);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> TInfoSinkBase& objSink() { return mObjSink; }
</span><span class="lines">@@ -50,6 +51,8 @@
</span><span class="cx"> TString hashVariableName(const TString& name);
</span><span class="cx"> // Same as hashName(), but without hashing built-in functions.
</span><span class="cx"> TString hashFunctionName(const TString& mangled_name);
</span><ins>+ // Used to translate function names for differences between ESSL and GLSL
+ virtual TString translateTextureFunction(TString& name) { return name; }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> bool structDeclared(const TStructure* structure) const;
</span><span class="lines">@@ -64,7 +67,8 @@
</span><span class="cx"> typedef std::set<TString> DeclaredStructs;
</span><span class="cx"> DeclaredStructs mDeclaredStructs;
</span><span class="cx">
</span><del>- ForLoopUnroll mLoopUnroll;
</del><ins>+ // Stack of loops that need to be unrolled.
+ TLoopStack mLoopUnrollStack;
</ins><span class="cx">
</span><span class="cx"> ShArrayIndexClampingStrategy mClampingStrategy;
</span><span class="cx">
</span><span class="lines">@@ -74,6 +78,8 @@
</span><span class="cx"> NameMap& mNameMap;
</span><span class="cx">
</span><span class="cx"> TSymbolTable& mSymbolTable;
</span><ins>+
+ const int mShaderVersion;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputHLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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,11 +7,14 @@
</span><span class="cx"> #include "compiler/translator/OutputHLSL.h"
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><ins>+#include "common/utilities.h"
+#include "common/blocklayout.h"
</ins><span class="cx"> #include "compiler/translator/compilerdebug.h"
</span><ins>+#include "compiler/translator/InfoSink.h"
</ins><span class="cx"> #include "compiler/translator/DetectDiscontinuity.h"
</span><del>-#include "compiler/translator/InfoSink.h"
</del><span class="cx"> #include "compiler/translator/SearchSymbol.h"
</span><span class="cx"> #include "compiler/translator/UnfoldShortCircuit.h"
</span><ins>+#include "compiler/translator/FlagStd140Structs.h"
</ins><span class="cx"> #include "compiler/translator/NodeSearch.h"
</span><span class="cx"> #include "compiler/translator/RewriteElseBlocks.h"
</span><span class="cx">
</span><span class="lines">@@ -22,27 +25,88 @@
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="cx">
</span><ins>+TString OutputHLSL::TextureFunction::name() const
+{
+ TString name = "gl_texture";
+
+ if (IsSampler2D(sampler))
+ {
+ name += "2D";
+ }
+ else if (IsSampler3D(sampler))
+ {
+ name += "3D";
+ }
+ else if (IsSamplerCube(sampler))
+ {
+ name += "Cube";
+ }
+ else UNREACHABLE();
+
+ if (proj)
+ {
+ name += "Proj";
+ }
+
+ if (offset)
+ {
+ name += "Offset";
+ }
+
+ switch(method)
+ {
+ case IMPLICIT: break;
+ case BIAS: break; // Extra parameter makes the signature unique
+ case LOD: name += "Lod"; break;
+ case LOD0: name += "Lod0"; break;
+ case LOD0BIAS: name += "Lod0"; break; // Extra parameter makes the signature unique
+ case SIZE: name += "Size"; break;
+ case FETCH: name += "Fetch"; break;
+ case GRAD: name += "Grad"; break;
+ default: UNREACHABLE();
+ }
+
+ return name + "(";
+}
+
+const char *RegisterPrefix(const TType &type)
+{
+ if (IsSampler(type.getBasicType()))
+ {
+ return "s";
+ }
+ else
+ {
+ return "c";
+ }
+}
+
+bool OutputHLSL::TextureFunction::operator<(const TextureFunction &rhs) const
+{
+ if (sampler < rhs.sampler) return true;
+ if (sampler > rhs.sampler) return false;
+
+ if (coords < rhs.coords) return true;
+ if (coords > rhs.coords) return false;
+
+ if (!proj && rhs.proj) return true;
+ if (proj && !rhs.proj) return false;
+
+ if (!offset && rhs.offset) return true;
+ if (offset && !rhs.offset) return false;
+
+ if (method < rhs.method) return true;
+ if (method > rhs.method) return false;
+
+ return false;
+}
+
</ins><span class="cx"> OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
</span><span class="cx"> : TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
</span><span class="cx"> {
</span><span class="cx"> mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
</span><span class="cx"> mInsideFunction = false;
</span><span class="cx">
</span><del>- mUsesTexture2D = false;
- mUsesTexture2D_bias = false;
- mUsesTexture2DProj = false;
- mUsesTexture2DProj_bias = false;
- mUsesTexture2DProjLod = false;
- mUsesTexture2DLod = false;
- mUsesTextureCube = false;
- mUsesTextureCube_bias = false;
- mUsesTextureCubeLod = false;
- mUsesTexture2DLod0 = false;
- mUsesTexture2DLod0_bias = false;
- mUsesTexture2DProjLod0 = false;
- mUsesTexture2DProjLod0_bias = false;
- mUsesTextureCubeLod0 = false;
- mUsesTextureCubeLod0_bias = false;
</del><span class="cx"> mUsesFragColor = false;
</span><span class="cx"> mUsesFragData = false;
</span><span class="cx"> mUsesDepthRange = false;
</span><span class="lines">@@ -68,6 +132,7 @@
</span><span class="cx"> mUsesAtan2_3 = false;
</span><span class="cx"> mUsesAtan2_4 = false;
</span><span class="cx"> mUsesDiscardRewriting = false;
</span><ins>+ mUsesNestedBreak = false;
</ins><span class="cx">
</span><span class="cx"> mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
</span><span class="cx">
</span><span class="lines">@@ -78,6 +143,7 @@
</span><span class="cx"> mContainsLoopDiscontinuity = false;
</span><span class="cx"> mOutputLod0Function = false;
</span><span class="cx"> mInsideDiscontinuousLoop = false;
</span><ins>+ mNestedLoopDepth = 0;
</ins><span class="cx">
</span><span class="cx"> mExcessiveLoopIndex = NULL;
</span><span class="cx">
</span><span class="lines">@@ -98,6 +164,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mSamplerRegister = 0;
</span><ins>+ mInterfaceBlockRegister = 2; // Reserve registers for the default uniform block and driver constants
+ mPaddingCounter = 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> OutputHLSL::~OutputHLSL()
</span><span class="lines">@@ -108,6 +176,8 @@
</span><span class="cx"> void OutputHLSL::output()
</span><span class="cx"> {
</span><span class="cx"> mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
</span><ins>+ const std::vector<TIntermTyped*> &flaggedStructs = FlagStd140ValueStructs(mContext.treeRoot);
+ makeFlaggedStructMaps(flaggedStructs);
</ins><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><span class="lines">@@ -123,72 +193,472 @@
</span><span class="cx"> mContext.infoSink().obj << mBody.c_str();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void OutputHLSL::makeFlaggedStructMaps(const std::vector<TIntermTyped *> &flaggedStructs)
+{
+ for (unsigned int structIndex = 0; structIndex < flaggedStructs.size(); structIndex++)
+ {
+ TIntermTyped *flaggedNode = flaggedStructs[structIndex];
+
+ // This will mark the necessary block elements as referenced
+ flaggedNode->traverse(this);
+ TString structName(mBody.c_str());
+ mBody.erase();
+
+ mFlaggedStructOriginalNames[flaggedNode] = structName;
+
+ for (size_t pos = structName.find('.'); pos != std::string::npos; pos = structName.find('.'))
+ {
+ structName.erase(pos, 1);
+ }
+
+ mFlaggedStructMappedNames[flaggedNode] = "map" + structName;
+ }
+}
+
</ins><span class="cx"> TInfoSinkBase &OutputHLSL::getBodyStream()
</span><span class="cx"> {
</span><span class="cx"> return mBody;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-const ActiveUniforms &OutputHLSL::getUniforms()
</del><ins>+const std::vector<gl::Uniform> &OutputHLSL::getUniforms()
</ins><span class="cx"> {
</span><span class="cx"> return mActiveUniforms;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const std::vector<gl::InterfaceBlock> &OutputHLSL::getInterfaceBlocks() const
+{
+ return mActiveInterfaceBlocks;
+}
+
+const std::vector<gl::Attribute> &OutputHLSL::getOutputVariables() const
+{
+ return mActiveOutputVariables;
+}
+
+const std::vector<gl::Attribute> &OutputHLSL::getAttributes() const
+{
+ return mActiveAttributes;
+}
+
+const std::vector<gl::Varying> &OutputHLSL::getVaryings() const
+{
+ return mActiveVaryings;
+}
+
</ins><span class="cx"> int OutputHLSL::vectorSize(const TType &type) const
</span><span class="cx"> {
</span><del>- int elementSize = type.isMatrix() ? type.getNominalSize() : 1;
</del><ins>+ int elementSize = type.isMatrix() ? type.getCols() : 1;
</ins><span class="cx"> int arraySize = type.isArray() ? type.getArraySize() : 1;
</span><span class="cx">
</span><span class="cx"> return elementSize * arraySize;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void OutputHLSL::header()
</del><ins>+TString OutputHLSL::interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, const TField &field)
</ins><span class="cx"> {
</span><del>- ShShaderType shaderType = mContext.shaderType;
- TInfoSinkBase &out = mHeader;
</del><ins>+ if (interfaceBlock.hasInstanceName())
+ {
+ return interfaceBlock.name() + "." + field.name();
+ }
+ else
+ {
+ return field.name();
+ }
+}
</ins><span class="cx">
</span><del>- for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
</del><ins>+TString OutputHLSL::decoratePrivate(const TString &privateText)
+{
+ return "dx_" + privateText;
+}
+
+TString OutputHLSL::interfaceBlockStructNameString(const TInterfaceBlock &interfaceBlock)
+{
+ return decoratePrivate(interfaceBlock.name()) + "_type";
+}
+
+TString OutputHLSL::interfaceBlockInstanceString(const TInterfaceBlock& interfaceBlock, unsigned int arrayIndex)
+{
+ if (!interfaceBlock.hasInstanceName())
</ins><span class="cx"> {
</span><del>- out << *structDeclaration;
</del><ins>+ return "";
</ins><span class="cx"> }
</span><ins>+ else if (interfaceBlock.isArray())
+ {
+ return decoratePrivate(interfaceBlock.instanceName()) + "_" + str(arrayIndex);
+ }
+ else
+ {
+ return decorate(interfaceBlock.instanceName());
+ }
+}
</ins><span class="cx">
</span><del>- for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
</del><ins>+TString OutputHLSL::interfaceBlockFieldTypeString(const TField &field, TLayoutBlockStorage blockStorage)
+{
+ const TType &fieldType = *field.type();
+ const TLayoutMatrixPacking matrixPacking = fieldType.getLayoutQualifier().matrixPacking;
+ ASSERT(matrixPacking != EmpUnspecified);
+
+ if (fieldType.isMatrix())
</ins><span class="cx"> {
</span><del>- out << *constructor;
</del><ins>+ // Use HLSL row-major packing for GLSL column-major matrices
+ const TString &matrixPackString = (matrixPacking == EmpRowMajor ? "column_major" : "row_major");
+ return matrixPackString + " " + typeString(fieldType);
</ins><span class="cx"> }
</span><ins>+ 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);
+ }
+}
</ins><span class="cx">
</span><ins>+TString OutputHLSL::interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, TLayoutBlockStorage blockStorage)
+{
+ TString hlsl;
+
+ int elementIndex = 0;
+
+ for (unsigned int typeIndex = 0; typeIndex < interfaceBlock.fields().size(); typeIndex++)
+ {
+ const TField &field = *interfaceBlock.fields()[typeIndex];
+ const TType &fieldType = *field.type();
+
+ if (blockStorage == EbsStd140)
+ {
+ // 2 and 3 component vector types in some cases need pre-padding
+ hlsl += std140PrePaddingString(fieldType, &elementIndex);
+ }
+
+ hlsl += " " + interfaceBlockFieldTypeString(field, blockStorage) +
+ " " + decorate(field.name()) + arrayString(fieldType) + ";\n";
+
+ // 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 &interfaceBlock)
+{
+ const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+
+ return "struct " + interfaceBlockStructNameString(interfaceBlock) + "\n"
+ "{\n" +
+ interfaceBlockFieldString(interfaceBlock, blockStorage) +
+ "};\n\n";
+}
+
+TString OutputHLSL::interfaceBlockString(const TInterfaceBlock &interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex)
+{
+ const TString &arrayIndexString = (arrayIndex != GL_INVALID_INDEX ? decorate(str(arrayIndex)) : "");
+ const TString &blockName = interfaceBlock.name() + arrayIndexString;
+ TString hlsl;
+
+ hlsl += "cbuffer " + blockName + " : register(b" + str(registerIndex) + ")\n"
+ "{\n";
+
+ if (interfaceBlock.hasInstanceName())
+ {
+ hlsl += " " + interfaceBlockStructNameString(interfaceBlock) + " " + interfaceBlockInstanceString(interfaceBlock, arrayIndex) + ";\n";
+ }
+ else
+ {
+ const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+ hlsl += interfaceBlockFieldString(interfaceBlock, blockStorage);
+ }
+
+ hlsl += "};\n\n";
+
+ return hlsl;
+}
+
+TString OutputHLSL::std140PrePaddingString(const TType &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 "";
+ }
+
+ const GLenum glType = glVariableType(type);
+ const int numComponents = gl::UniformComponentCount(glType);
+
+ if (numComponents >= 4)
+ {
+ // no padding needed, HLSL will align the field to a new register
+ *elementIndex = 0;
+ return "";
+ }
+
+ if (*elementIndex + numComponents > 4)
+ {
+ // no padding needed, HLSL will align the field to a new register
+ *elementIndex = numComponents;
+ return "";
+ }
+
+ 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 < alignment; paddingIndex++)
+ {
+ padding += " float pad_" + str(mPaddingCounter++) + ";\n";
+ }
+
+ *elementIndex += (alignment - paddingOffset);
+ }
+
+ *elementIndex += numComponents;
+ *elementIndex %= 4;
+
+ return padding;
+}
+
+TString OutputHLSL::std140PostPaddingString(const TType &type, bool useHLSLRowMajorPacking)
+{
+ if (!type.isMatrix() && !type.isArray() && type.getBasicType() != EbtStruct)
+ {
+ return "";
+ }
+
+ 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 &structName = structureTypeName(*type.getStruct(), useHLSLRowMajorPacking, true);
+ numComponents = mStd140StructElementIndexes[structName];
+
+ if (numComponents == 0)
+ {
+ return "";
+ }
+ }
+ else
+ {
+ const GLenum glType = glVariableType(type);
+ numComponents = gl::UniformComponentCount(glType);
+ }
+
+ TString padding;
+ for (int paddingOffset = numComponents; paddingOffset < 4; paddingOffset++)
+ {
+ padding += " float pad_" + str(mPaddingCounter++) + ";\n";
+ }
+ return padding;
+}
+
+// Use the same layout for packed and shared
+void setBlockLayout(gl::InterfaceBlock *interfaceBlock, gl::BlockLayoutType newLayout)
+{
+ interfaceBlock->layout = newLayout;
+ interfaceBlock->blockInfo.clear();
+
+ switch (newLayout)
+ {
+ case gl::BLOCKLAYOUT_SHARED:
+ case gl::BLOCKLAYOUT_PACKED:
+ {
+ gl::HLSLBlockEncoder hlslEncoder(&interfaceBlock->blockInfo);
+ hlslEncoder.encodeInterfaceBlockFields(interfaceBlock->fields);
+ interfaceBlock->dataSize = hlslEncoder.getBlockSize();
+ }
+ break;
+
+ case gl::BLOCKLAYOUT_STANDARD:
+ {
+ gl::Std140BlockEncoder stdEncoder(&interfaceBlock->blockInfo);
+ stdEncoder.encodeInterfaceBlockFields(interfaceBlock->fields);
+ interfaceBlock->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;
+ }
+}
+
+TString OutputHLSL::structInitializerString(int indent, const TStructure &structure, const TString &rhsStructName)
+{
+ TString init;
+
+ TString preIndentString;
+ TString fullIndentString;
+
+ for (int spaces = 0; spaces < (indent * 4); spaces++)
+ {
+ preIndentString += ' ';
+ }
+
+ for (int spaces = 0; spaces < ((indent+1) * 4); spaces++)
+ {
+ fullIndentString += ' ';
+ }
+
+ init += preIndentString + "{\n";
+
+ const TFieldList &fields = structure.fields();
+ for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ const TField &field = *fields[fieldIndex];
+ const TString &fieldName = rhsStructName + "." + decorate(field.name());
+ const TType &fieldType = *field.type();
+
+ if (fieldType.getStruct())
+ {
+ init += structInitializerString(indent + 1, *fieldType.getStruct(), fieldName);
+ }
+ else
+ {
+ init += fullIndentString + fieldName + ",\n";
+ }
+ }
+
+ init += preIndentString + "}" + (indent == 0 ? ";" : ",") + "\n";
+
+ return init;
+}
+
+void OutputHLSL::header()
+{
+ TInfoSinkBase &out = mHeader;
+
</ins><span class="cx"> TString uniforms;
</span><ins>+ TString interfaceBlocks;
</ins><span class="cx"> TString varyings;
</span><span class="cx"> TString attributes;
</span><ins>+ TString flaggedStructs;
</ins><span class="cx">
</span><del>- for (ReferencedSymbols::const_iterator uniform = mReferencedUniforms.begin(); uniform != mReferencedUniforms.end(); uniform++)
</del><ins>+ for (ReferencedSymbols::const_iterator uniformIt = mReferencedUniforms.begin(); uniformIt != mReferencedUniforms.end(); uniformIt++)
</ins><span class="cx"> {
</span><del>- const TType &type = uniform->second->getType();
- const TString &name = uniform->second->getSymbol();
</del><ins>+ const TIntermSymbol &uniform = *uniformIt->second;
+ const TType &type = uniform.getType();
+ const TString &name = uniform.getSymbol();
</ins><span class="cx">
</span><ins>+ int registerIndex = declareUniformAndAssignRegister(type, name);
+
</ins><span class="cx"> if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType())) // Also declare the texture
</span><span class="cx"> {
</span><del>- int index = samplerRegister(mReferencedUniforms[name]);
</del><ins>+ uniforms += "uniform " + samplerString(type) + " sampler_" + decorateUniform(name, type) + arrayString(type) +
+ " : register(s" + str(registerIndex) + ");\n";
</ins><span class="cx">
</span><del>- uniforms += "uniform SamplerState sampler_" + decorateUniform(name, type) + arrayString(type) +
- " : register(s" + str(index) + ");\n";
</del><ins>+ uniforms += "uniform " + textureString(type) + " texture_" + decorateUniform(name, type) + arrayString(type) +
+ " : register(t" + str(registerIndex) + ");\n";
+ }
+ else
+ {
+ const TStructure *structure = type.getStruct();
+ const TString &typeName = (structure ? structureTypeName(*structure, false, false) : typeString(type));
</ins><span class="cx">
</span><del>- uniforms += "uniform " + textureString(type) + " texture_" + decorateUniform(name, type) + arrayString(type) +
- " : register(t" + str(index) + ");\n";
</del><ins>+ const TString &registerString = TString("register(") + RegisterPrefix(type) + str(registerIndex) + ")";
+
+ uniforms += "uniform " + typeName + " " + decorateUniform(name, type) + arrayString(type) + " : " + registerString + ";\n";
</ins><span class="cx"> }
</span><ins>+ }
+
+ for (ReferencedSymbols::const_iterator interfaceBlockIt = mReferencedInterfaceBlocks.begin(); interfaceBlockIt != mReferencedInterfaceBlocks.end(); interfaceBlockIt++)
+ {
+ const TType &nodeType = interfaceBlockIt->second->getType();
+ const TInterfaceBlock &interfaceBlock = *nodeType.getInterfaceBlock();
+ const TFieldList &fieldList = interfaceBlock.fields();
+
+ unsigned int arraySize = static_cast<unsigned int>(interfaceBlock.arraySize());
+ gl::InterfaceBlock activeBlock(interfaceBlock.name().c_str(), arraySize, mInterfaceBlockRegister);
+ for (unsigned int typeIndex = 0; typeIndex < fieldList.size(); typeIndex++)
+ {
+ const TField &field = *fieldList[typeIndex];
+ const TString &fullUniformName = interfaceBlockFieldString(interfaceBlock, field);
+ declareInterfaceBlockField(*field.type(), fullUniformName, activeBlock.fields);
+ }
+
+ mInterfaceBlockRegister += std::max(1u, arraySize);
+
+ gl::BlockLayoutType blockLayoutType = convertBlockLayoutType(interfaceBlock.blockStorage());
+ setBlockLayout(&activeBlock, blockLayoutType);
+
+ if (interfaceBlock.matrixPacking() == EmpRowMajor)
+ {
+ activeBlock.isRowMajorLayout = true;
+ }
+
+ mActiveInterfaceBlocks.push_back(activeBlock);
+
+ if (interfaceBlock.hasInstanceName())
+ {
+ interfaceBlocks += interfaceBlockStructString(interfaceBlock);
+ }
+
+ if (arraySize > 0)
+ {
+ for (unsigned int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex + arrayIndex, arrayIndex);
+ }
+ }
</ins><span class="cx"> else
</span><span class="cx"> {
</span><del>- uniforms += "uniform " + typeString(type) + " " + decorateUniform(name, type) + arrayString(type) +
- " : register(" + registerString(mReferencedUniforms[name]) + ");\n";
</del><ins>+ interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex, GL_INVALID_INDEX);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ for (std::map<TIntermTyped*, TString>::const_iterator flaggedStructIt = mFlaggedStructMappedNames.begin(); flaggedStructIt != mFlaggedStructMappedNames.end(); flaggedStructIt++)
+ {
+ TIntermTyped *structNode = flaggedStructIt->first;
+ const TString &mappedName = flaggedStructIt->second;
+ const TStructure &structure = *structNode->getType().getStruct();
+ const TString &originalName = mFlaggedStructOriginalNames[structNode];
+
+ flaggedStructs += "static " + decorate(structure.name()) + " " + mappedName + " =\n";
+ flaggedStructs += structInitializerString(0, structure, originalName);
+ flaggedStructs += "\n";
+ }
+
</ins><span class="cx"> for (ReferencedSymbols::const_iterator varying = mReferencedVaryings.begin(); varying != mReferencedVaryings.end(); varying++)
</span><span class="cx"> {
</span><span class="cx"> const TType &type = varying->second->getType();
</span><span class="cx"> const TString &name = varying->second->getSymbol();
</span><span class="cx">
</span><span class="cx"> // Program linking depends on this exact format
</span><del>- varyings += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
</del><ins>+ varyings += "static " + interpolationString(type.getQualifier()) + " " + typeString(type) + " " +
+ decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
+
+ declareVaryingToList(type, type.getQualifier(), name, mActiveVaryings);
</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">@@ -197,36 +667,76 @@
</span><span class="cx"> const TString &name = attribute->second->getSymbol();
</span><span class="cx">
</span><span class="cx"> attributes += "static " + typeString(type) + " " + decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
</span><ins>+
+ gl::Attribute attributeVar(glVariableType(type), glVariablePrecision(type), name.c_str(),
+ (unsigned int)type.getArraySize(), type.getLayoutQualifier().location);
+ mActiveAttributes.push_back(attributeVar);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
+ {
+ out << *structDeclaration;
+ }
+
+ for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
+ {
+ out << *constructor;
+ }
+
</ins><span class="cx"> if (mUsesDiscardRewriting)
</span><span class="cx"> {
</span><span class="cx"> out << "#define ANGLE_USES_DISCARD_REWRITING" << "\n";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (shaderType == SH_FRAGMENT_SHADER)
</del><ins>+ if (mUsesNestedBreak)
</ins><span class="cx"> {
</span><ins>+ out << "#define ANGLE_USES_NESTED_BREAK" << "\n";
+ }
+
+ if (mContext.shaderType == SH_FRAGMENT_SHADER)
+ {
</ins><span class="cx"> TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
</span><span class="cx"> const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() && (iter->second == EBhEnable || iter->second == EBhRequire));
</span><span class="cx">
</span><del>- const unsigned int numColorValues = usingMRTExtension ? mNumRenderTargets : 1;
-
</del><span class="cx"> out << "// Varyings\n";
</span><span class="cx"> out << varyings;
</span><del>- out << "\n"
- "static float4 gl_Color[" << numColorValues << "] =\n"
- "{\n";
- for (unsigned int i = 0; i < numColorValues; i++)
</del><ins>+ out << "\n";
+
+ if (mContext.getShaderVersion() >= 300)
</ins><span class="cx"> {
</span><del>- out << " float4(0, 0, 0, 0)";
- if (i + 1 != numColorValues)
</del><ins>+ for (ReferencedSymbols::const_iterator outputVariableIt = mReferencedOutputVariables.begin(); outputVariableIt != mReferencedOutputVariables.end(); outputVariableIt++)
</ins><span class="cx"> {
</span><del>- out << ",";
</del><ins>+ const TString &variableName = outputVariableIt->first;
+ const TType &variableType = outputVariableIt->second->getType();
+ const TLayoutQualifier &layoutQualifier = variableType.getLayoutQualifier();
+
+ out << "static " + typeString(variableType) + " out_" + variableName + arrayString(variableType) +
+ " = " + initializer(variableType) + ";\n";
+
+ gl::Attribute outputVar(glVariableType(variableType), glVariablePrecision(variableType), variableName.c_str(),
+ (unsigned int)variableType.getArraySize(), layoutQualifier.location);
+ mActiveOutputVariables.push_back(outputVar);
</ins><span class="cx"> }
</span><del>- out << "\n";
</del><span class="cx"> }
</span><del>- out << "};\n";
</del><ins>+ else
+ {
+ const unsigned int numColorValues = usingMRTExtension ? mNumRenderTargets : 1;
</ins><span class="cx">
</span><ins>+ out << "static float4 gl_Color[" << numColorValues << "] =\n"
+ "{\n";
+ for (unsigned int i = 0; i < numColorValues; i++)
+ {
+ out << " float4(0, 0, 0, 0)";
+ if (i + 1 != numColorValues)
+ {
+ out << ",";
+ }
+ out << "\n";
+ }
+
+ out << "};\n";
+ }
+
</ins><span class="cx"> if (mUsesFragDepth)
</span><span class="cx"> {
</span><span class="cx"> out << "static float gl_Depth = 0.0;\n";
</span><span class="lines">@@ -311,300 +821,20 @@
</span><span class="cx"> out << uniforms;
</span><span class="cx"> out << "\n";
</span><span class="cx">
</span><del>- if (mUsesTexture2D)
</del><ins>+ if (!interfaceBlocks.empty())
</ins><span class="cx"> {
</span><del>- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2D(s, t);\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv)\n"
- "{\n"
- " return t.Sample(s, uv);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
</del><ins>+ out << interfaceBlocks;
+ out << "\n";
</ins><span class="cx">
</span><del>- if (mUsesTexture2D_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
</del><ins>+ if (!flaggedStructs.empty())
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2D(sampler2D s, float2 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x, t.y, 0, bias));\n"
- "}\n"
- "\n";
</del><ins>+ out << "// Std140 Structures accessed by value\n";
+ out << "\n";
+ out << flaggedStructs;
+ out << "\n";
</ins><span class="cx"> }
</span><del>- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv, float bias)\n"
- "{\n"
- " return t.SampleBias(s, uv, bias);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
</del><span class="cx"> }
</span><span class="cx">
</span><del>- if (mUsesTexture2DProj)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dproj(s, float4(t.x, t.y, 0, t.z));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dproj(s, t);\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.Sample(s, float2(uvw.x / uvw.z, uvw.y / uvw.z));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
- "{\n"
- " return t.Sample(s, float2(uvw.x / uvw.w, uvw.y / uvw.w));\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProj_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProj(sampler2D s, float3 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x / t.z, t.y / t.z, 0, bias));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t, float bias)\n"
- "{\n"
- " return tex2Dbias(s, float4(t.x / t.w, t.y / t.w, 0, bias));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleBias(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), bias);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw, float bias)\n"
- "{\n"
- " return t.SampleBias(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), bias);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCube)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBE(s, t);\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.Sample(s, uvw);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCube_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCube(samplerCUBE s, float3 t, float bias)\n"
- "{\n"
- " return texCUBEbias(s, float4(t.x, t.y, t.z, bias));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleBias(s, uvw, bias);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- // These *Lod0 intrinsics are not available in GL fragment shaders.
- // They are used to sample using discontinuous texture coordinates.
- if (mUsesTexture2DLod0)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(Texture2D t, SamplerState s, float2 uv)\n"
- "{\n"
- " return t.SampleLevel(s, uv, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DLod0_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(sampler2D s, float2 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DLod0(Texture2D t, SamplerState s, float2 uv, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, uv, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProjLod0)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod0(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod0(Texture2D t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod0(Texture2D t, SamplerState s, float4 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTexture2DProjLod0_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod0_bias(sampler2D s, float3 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod_bias(sampler2D s, float4 t, float bias)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_texture2DProjLod_bias(Texture2D t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod_bias(Texture2D t, SamplerState s, float4 uvw, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCubeLod0)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(TextureCube t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
- if (mUsesTextureCubeLod0_bias)
- {
- if (mOutputType == SH_HLSL9_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t, float bias)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
- }
- else if (mOutputType == SH_HLSL11_OUTPUT)
- {
- out << "float4 gl_textureCubeLod0(TextureCube t, SamplerState s, float3 uvw, float bias)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, 0);\n"
- "}\n"
- "\n";
- }
- else UNREACHABLE();
- }
-
</del><span class="cx"> if (usingMRTExtension && mNumRenderTargets > 1)
</span><span class="cx"> {
</span><span class="cx"> out << "#define GL_USES_MRT\n";
</span><span class="lines">@@ -679,151 +909,639 @@
</span><span class="cx"> out << uniforms;
</span><span class="cx"> out << "\n";
</span><span class="cx">
</span><del>- if (mUsesTexture2D)
</del><ins>+ if (!interfaceBlocks.empty())
</ins><span class="cx"> {
</span><del>- if (mOutputType == SH_HLSL9_OUTPUT)
</del><ins>+ out << interfaceBlocks;
+ out << "\n";
+
+ if (!flaggedStructs.empty())
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2D(sampler2D s, float2 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, 0));\n"
- "}\n"
- "\n";
</del><ins>+ out << "// Std140 Structures accessed by value\n";
+ out << "\n";
+ out << flaggedStructs;
+ out << "\n";
</ins><span class="cx"> }
</span><del>- else if (mOutputType == SH_HLSL11_OUTPUT)
</del><ins>+ }
+ }
+
+ for (TextureFunctionSet::const_iterator textureFunction = mUsesTexture.begin(); textureFunction != mUsesTexture.end(); textureFunction++)
+ {
+ // Return type
+ if (textureFunction->method == TextureFunction::SIZE)
+ {
+ switch(textureFunction->sampler)
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2D(Texture2D t, SamplerState s, float2 uv)\n"
- "{\n"
- " return t.SampleLevel(s, uv, 0);\n"
- "}\n"
- "\n";
</del><ins>+ case EbtSampler2D: out << "int2 "; break;
+ case EbtSampler3D: out << "int3 "; break;
+ case EbtSamplerCube: out << "int2 "; break;
+ case EbtSampler2DArray: out << "int3 "; break;
+ case EbtISampler2D: out << "int2 "; break;
+ case EbtISampler3D: out << "int3 "; break;
+ case EbtISamplerCube: out << "int2 "; break;
+ case EbtISampler2DArray: out << "int3 "; break;
+ case EbtUSampler2D: out << "int2 "; break;
+ case EbtUSampler3D: out << "int3 "; break;
+ case EbtUSamplerCube: out << "int2 "; break;
+ case EbtUSampler2DArray: out << "int3 "; break;
+ case EbtSampler2DShadow: out << "int2 "; break;
+ case EbtSamplerCubeShadow: out << "int2 "; break;
+ case EbtSampler2DArrayShadow: out << "int3 "; break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>- else UNREACHABLE();
</del><span class="cx"> }
</span><ins>+ else // Sampling function
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "float4 "; break;
+ case EbtSampler3D: out << "float4 "; break;
+ case EbtSamplerCube: out << "float4 "; break;
+ case EbtSampler2DArray: out << "float4 "; break;
+ case EbtISampler2D: out << "int4 "; break;
+ case EbtISampler3D: out << "int4 "; break;
+ case EbtISamplerCube: out << "int4 "; break;
+ case EbtISampler2DArray: out << "int4 "; break;
+ case EbtUSampler2D: out << "uint4 "; break;
+ case EbtUSampler3D: out << "uint4 "; break;
+ case EbtUSamplerCube: out << "uint4 "; break;
+ case EbtUSampler2DArray: out << "uint4 "; break;
+ case EbtSampler2DShadow: out << "float "; break;
+ case EbtSamplerCubeShadow: out << "float "; break;
+ case EbtSampler2DArrayShadow: out << "float "; break;
+ default: UNREACHABLE();
+ }
+ }
</ins><span class="cx">
</span><del>- if (mUsesTexture2DLod)
</del><ins>+ // Function name
+ out << textureFunction->name();
+
+ // Argument list
+ int hlslCoords = 4;
+
+ if (mOutputType == SH_HLSL9_OUTPUT)
</ins><span class="cx"> {
</span><del>- if (mOutputType == SH_HLSL9_OUTPUT)
</del><ins>+ switch(textureFunction->sampler)
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2DLod(sampler2D s, float2 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x, t.y, 0, lod));\n"
- "}\n"
- "\n";
</del><ins>+ case EbtSampler2D: out << "sampler2D s"; hlslCoords = 2; break;
+ case EbtSamplerCube: out << "samplerCUBE s"; hlslCoords = 3; break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>- else if (mOutputType == SH_HLSL11_OUTPUT)
</del><ins>+
+ switch(textureFunction->method)
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2DLod(Texture2D t, SamplerState s, float2 uv, float lod)\n"
- "{\n"
- " return t.SampleLevel(s, uv, lod);\n"
- "}\n"
- "\n";
</del><ins>+ case TextureFunction::IMPLICIT: break;
+ case TextureFunction::BIAS: hlslCoords = 4; break;
+ case TextureFunction::LOD: hlslCoords = 4; break;
+ case TextureFunction::LOD0: hlslCoords = 4; break;
+ case TextureFunction::LOD0BIAS: hlslCoords = 4; break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>- else UNREACHABLE();
</del><span class="cx"> }
</span><ins>+ else if (mOutputType == SH_HLSL11_OUTPUT)
+ {
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "Texture2D x, SamplerState s"; hlslCoords = 2; break;
+ case EbtSampler3D: out << "Texture3D x, SamplerState s"; hlslCoords = 3; break;
+ case EbtSamplerCube: out << "TextureCube x, SamplerState s"; hlslCoords = 3; break;
+ case EbtSampler2DArray: out << "Texture2DArray x, SamplerState s"; hlslCoords = 3; break;
+ case EbtISampler2D: out << "Texture2D<int4> x, SamplerState s"; hlslCoords = 2; break;
+ case EbtISampler3D: out << "Texture3D<int4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtISamplerCube: out << "Texture2DArray<int4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtISampler2DArray: out << "Texture2DArray<int4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtUSampler2D: out << "Texture2D<uint4> x, SamplerState s"; hlslCoords = 2; break;
+ case EbtUSampler3D: out << "Texture3D<uint4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtUSamplerCube: out << "Texture2DArray<uint4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtUSampler2DArray: out << "Texture2DArray<uint4> x, SamplerState s"; hlslCoords = 3; break;
+ case EbtSampler2DShadow: out << "Texture2D x, SamplerComparisonState s"; hlslCoords = 2; break;
+ case EbtSamplerCubeShadow: out << "TextureCube x, SamplerComparisonState s"; hlslCoords = 3; break;
+ case EbtSampler2DArrayShadow: out << "Texture2DArray x, SamplerComparisonState s"; hlslCoords = 3; break;
+ default: UNREACHABLE();
+ }
+ }
+ else UNREACHABLE();
</ins><span class="cx">
</span><del>- if (mUsesTexture2DProj)
</del><ins>+ if (textureFunction->method == TextureFunction::FETCH) // Integer coordinates
</ins><span class="cx"> {
</span><del>- if (mOutputType == SH_HLSL9_OUTPUT)
</del><ins>+ switch(textureFunction->coords)
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2DProj(sampler2D s, float3 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, 0));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(sampler2D s, float4 t)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, 0));\n"
- "}\n"
- "\n";
</del><ins>+ case 2: out << ", int2 t"; break;
+ case 3: out << ", int3 t"; break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>- else if (mOutputType == SH_HLSL11_OUTPUT)
</del><ins>+ }
+ else // Floating-point coordinates (except textureSize)
+ {
+ switch(textureFunction->coords)
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2DProj(Texture2D t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), 0);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProj(Texture2D t, SamplerState s, float4 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), 0);\n"
- "}\n"
- "\n";
</del><ins>+ case 1: out << ", int lod"; break; // textureSize()
+ case 2: out << ", float2 t"; break;
+ case 3: out << ", float3 t"; break;
+ case 4: out << ", float4 t"; break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>- else UNREACHABLE();
</del><span class="cx"> }
</span><span class="cx">
</span><del>- if (mUsesTexture2DProjLod)
</del><ins>+ if (textureFunction->method == TextureFunction::GRAD)
</ins><span class="cx"> {
</span><del>- if (mOutputType == SH_HLSL9_OUTPUT)
</del><ins>+ switch(textureFunction->sampler)
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2DProjLod(sampler2D s, float3 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.z, t.y / t.z, 0, lod));\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod(sampler2D s, float4 t, float lod)\n"
- "{\n"
- " return tex2Dlod(s, float4(t.x / t.w, t.y / t.w, 0, lod));\n"
- "}\n"
- "\n";
</del><ins>+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ out << ", float2 ddx, float2 ddy";
+ break;
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCubeShadow:
+ out << ", float3 ddx, float3 ddy";
+ break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>- else if (mOutputType == SH_HLSL11_OUTPUT)
</del><ins>+ }
+
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: break;
+ case TextureFunction::BIAS: break; // Comes after the offset parameter
+ case TextureFunction::LOD: out << ", float lod"; break;
+ case TextureFunction::LOD0: break;
+ case TextureFunction::LOD0BIAS: break; // Comes after the offset parameter
+ case TextureFunction::SIZE: break;
+ case TextureFunction::FETCH: out << ", int mip"; break;
+ case TextureFunction::GRAD: break;
+ default: UNREACHABLE();
+ }
+
+ if (textureFunction->offset)
+ {
+ switch(textureFunction->sampler)
</ins><span class="cx"> {
</span><del>- out << "float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float3 uvw, float lod)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.z, uvw.y / uvw.z), lod);\n"
- "}\n"
- "\n"
- "float4 gl_texture2DProjLod(Texture2D t, SamplerState s, float4 uvw, float lod)\n"
- "{\n"
- " return t.SampleLevel(s, float2(uvw.x / uvw.w, uvw.y / uvw.w), lod);\n"
- "}\n"
- "\n";
</del><ins>+ case EbtSampler2D: out << ", int2 offset"; break;
+ case EbtSampler3D: out << ", int3 offset"; break;
+ case EbtSampler2DArray: out << ", int2 offset"; break;
+ case EbtISampler2D: out << ", int2 offset"; break;
+ case EbtISampler3D: out << ", int3 offset"; break;
+ case EbtISampler2DArray: out << ", int2 offset"; break;
+ case EbtUSampler2D: out << ", int2 offset"; break;
+ case EbtUSampler3D: out << ", int3 offset"; break;
+ case EbtUSampler2DArray: out << ", int2 offset"; break;
+ case EbtSampler2DShadow: out << ", int2 offset"; break;
+ case EbtSampler2DArrayShadow: out << ", int2 offset"; break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><ins>+ }
+
+ if (textureFunction->method == TextureFunction::BIAS ||
+ textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << ", float bias";
+ }
+
+ out << ")\n"
+ "{\n";
+
+ if (textureFunction->method == TextureFunction::SIZE)
+ {
+ if (IsSampler2D(textureFunction->sampler) || IsSamplerCube(textureFunction->sampler))
+ {
+ if (IsSamplerArray(textureFunction->sampler))
+ {
+ out << " uint width; uint height; uint layers; uint numberOfLevels;\n"
+ " x.GetDimensions(lod, width, height, layers, numberOfLevels);\n";
+ }
+ else
+ {
+ out << " uint width; uint height; uint numberOfLevels;\n"
+ " x.GetDimensions(lod, width, height, numberOfLevels);\n";
+ }
+ }
+ else if (IsSampler3D(textureFunction->sampler))
+ {
+ out << " uint width; uint height; uint depth; uint numberOfLevels;\n"
+ " x.GetDimensions(lod, width, height, depth, numberOfLevels);\n";
+ }
</ins><span class="cx"> else UNREACHABLE();
</span><ins>+
+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << " return int2(width, height);"; break;
+ case EbtSampler3D: out << " return int3(width, height, depth);"; break;
+ case EbtSamplerCube: out << " return int2(width, height);"; break;
+ case EbtSampler2DArray: out << " return int3(width, height, layers);"; break;
+ case EbtISampler2D: out << " return int2(width, height);"; break;
+ case EbtISampler3D: out << " return int3(width, height, depth);"; break;
+ case EbtISamplerCube: out << " return int2(width, height);"; break;
+ case EbtISampler2DArray: out << " return int3(width, height, layers);"; break;
+ case EbtUSampler2D: out << " return int2(width, height);"; break;
+ case EbtUSampler3D: out << " return int3(width, height, depth);"; break;
+ case EbtUSamplerCube: out << " return int2(width, height);"; break;
+ case EbtUSampler2DArray: out << " return int3(width, height, layers);"; break;
+ case EbtSampler2DShadow: out << " return int2(width, height);"; break;
+ case EbtSamplerCubeShadow: out << " return int2(width, height);"; break;
+ case EbtSampler2DArrayShadow: out << " return int3(width, height, layers);"; break;
+ default: UNREACHABLE();
+ }
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ if (IsIntegerSampler(textureFunction->sampler) && IsSamplerCube(textureFunction->sampler))
+ {
+ out << " float width; float height; float layers; float levels;\n";
</ins><span class="cx">
</span><del>- if (mUsesTextureCube)
- {
</del><ins>+ out << " uint mip = 0;\n";
+
+ out << " x.GetDimensions(mip, width, height, layers, levels);\n";
+
+ out << " bool xMajor = abs(t.x) > abs(t.y) && abs(t.x) > abs(t.z);\n";
+ out << " bool yMajor = abs(t.y) > abs(t.z) && abs(t.y) > abs(t.x);\n";
+ out << " bool zMajor = abs(t.z) > abs(t.x) && abs(t.z) > abs(t.y);\n";
+ out << " bool negative = (xMajor && t.x < 0.0f) || (yMajor && t.y < 0.0f) || (zMajor && t.z < 0.0f);\n";
+
+ // FACE_POSITIVE_X = 000b
+ // FACE_NEGATIVE_X = 001b
+ // FACE_POSITIVE_Y = 010b
+ // FACE_NEGATIVE_Y = 011b
+ // FACE_POSITIVE_Z = 100b
+ // FACE_NEGATIVE_Z = 101b
+ out << " int face = (int)negative + (int)yMajor * 2 + (int)zMajor * 4;\n";
+
+ out << " float u = xMajor ? -t.z : (yMajor && t.y < 0.0f ? -t.x : t.x);\n";
+ out << " float v = yMajor ? t.z : (negative ? t.y : -t.y);\n";
+ out << " float m = xMajor ? t.x : (yMajor ? t.y : t.z);\n";
+
+ out << " t.x = (u * 0.5f / m) + 0.5f;\n";
+ out << " t.y = (v * 0.5f / m) + 0.5f;\n";
+ }
+ else if (IsIntegerSampler(textureFunction->sampler) &&
+ textureFunction->method != TextureFunction::FETCH)
+ {
+ if (IsSampler2D(textureFunction->sampler))
+ {
+ if (IsSamplerArray(textureFunction->sampler))
+ {
+ out << " float width; float height; float layers; float levels;\n";
+
+ if (textureFunction->method == TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ if (textureFunction->method == TextureFunction::IMPLICIT ||
+ textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " x.GetDimensions(0, width, height, layers, levels);\n"
+ " float2 tSized = float2(t.x * width, t.y * height);\n"
+ " float dx = length(ddx(tSized));\n"
+ " float dy = length(ddy(tSized));\n"
+ " float lod = log2(max(dx, dy));\n";
+
+ if (textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction->method == TextureFunction::GRAD)
+ {
+ out << " x.GetDimensions(0, width, height, layers, levels);\n"
+ " float lod = log2(max(length(ddx), length(ddy)));\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " x.GetDimensions(mip, width, height, layers, levels);\n";
+ }
+ else
+ {
+ out << " float width; float height; float levels;\n";
+
+ if (textureFunction->method == TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ if (textureFunction->method == TextureFunction::IMPLICIT ||
+ textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " x.GetDimensions(0, width, height, levels);\n"
+ " float2 tSized = float2(t.x * width, t.y * height);\n"
+ " float dx = length(ddx(tSized));\n"
+ " float dy = length(ddy(tSized));\n"
+ " float lod = log2(max(dx, dy));\n";
+
+ if (textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction->method == TextureFunction::LOD)
+ {
+ out << " x.GetDimensions(0, width, height, levels);\n";
+ }
+ else if (textureFunction->method == TextureFunction::GRAD)
+ {
+ out << " x.GetDimensions(0, width, height, levels);\n"
+ " float lod = log2(max(length(ddx), length(ddy)));\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " x.GetDimensions(mip, width, height, levels);\n";
+ }
+ }
+ else if (IsSampler3D(textureFunction->sampler))
+ {
+ out << " float width; float height; float depth; float levels;\n";
+
+ if (textureFunction->method == TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction->method == TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ if (textureFunction->method == TextureFunction::IMPLICIT ||
+ textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " x.GetDimensions(0, width, height, depth, levels);\n"
+ " float3 tSized = float3(t.x * width, t.y * height, t.z * depth);\n"
+ " float dx = length(ddx(tSized));\n"
+ " float dy = length(ddy(tSized));\n"
+ " float lod = log2(max(dx, dy));\n";
+
+ if (textureFunction->method == TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction->method == TextureFunction::GRAD)
+ {
+ out << " x.GetDimensions(0, width, height, depth, levels);\n"
+ " float lod = log2(max(length(ddx), length(ddy)));\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " x.GetDimensions(mip, width, height, depth, levels);\n";
+ }
+ else UNREACHABLE();
+ }
+
+ out << " return ";
+
+ // HLSL intrinsic
</ins><span class="cx"> if (mOutputType == SH_HLSL9_OUTPUT)
</span><span class="cx"> {
</span><del>- out << "float4 gl_textureCube(samplerCUBE s, float3 t)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, 0));\n"
- "}\n"
- "\n";
</del><ins>+ switch(textureFunction->sampler)
+ {
+ case EbtSampler2D: out << "tex2D"; break;
+ case EbtSamplerCube: out << "texCUBE"; break;
+ default: UNREACHABLE();
+ }
+
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: out << "(s, "; break;
+ case TextureFunction::BIAS: out << "bias(s, "; break;
+ case TextureFunction::LOD: out << "lod(s, "; break;
+ case TextureFunction::LOD0: out << "lod(s, "; break;
+ case TextureFunction::LOD0BIAS: out << "lod(s, "; break;
+ default: UNREACHABLE();
+ }
</ins><span class="cx"> }
</span><span class="cx"> else if (mOutputType == SH_HLSL11_OUTPUT)
</span><span class="cx"> {
</span><del>- out << "float4 gl_textureCube(TextureCube t, SamplerState s, float3 uvw)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, 0);\n"
- "}\n"
- "\n";
</del><ins>+ if (textureFunction->method == TextureFunction::GRAD)
+ {
+ if (IsIntegerSampler(textureFunction->sampler))
+ {
+ out << "x.Load(";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ out << "x.SampleCmpLevelZero(s, ";
+ }
+ else
+ {
+ out << "x.SampleGrad(s, ";
+ }
+ }
+ else if (IsIntegerSampler(textureFunction->sampler) ||
+ textureFunction->method == TextureFunction::FETCH)
+ {
+ out << "x.Load(";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ out << "x.SampleCmp(s, ";
+ }
+ else
+ {
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: out << "x.Sample(s, "; break;
+ case TextureFunction::BIAS: out << "x.SampleBias(s, "; break;
+ case TextureFunction::LOD: out << "x.SampleLevel(s, "; break;
+ case TextureFunction::LOD0: out << "x.SampleLevel(s, "; break;
+ case TextureFunction::LOD0BIAS: out << "x.SampleLevel(s, "; break;
+ default: UNREACHABLE();
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx"> else UNREACHABLE();
</span><del>- }
</del><span class="cx">
</span><del>- if (mUsesTextureCubeLod)
- {
</del><ins>+ // Integer sampling requires integer addresses
+ TString addressx = "";
+ TString addressy = "";
+ TString addressz = "";
+ TString close = "";
+
+ if (IsIntegerSampler(textureFunction->sampler) ||
+ textureFunction->method == TextureFunction::FETCH)
+ {
+ switch(hlslCoords)
+ {
+ case 2: out << "int3("; break;
+ case 3: out << "int4("; break;
+ default: UNREACHABLE();
+ }
+
+ // Convert from normalized floating-point to integer
+ if (textureFunction->method != TextureFunction::FETCH)
+ {
+ addressx = "int(floor(width * frac((";
+ addressy = "int(floor(height * frac((";
+
+ if (IsSamplerArray(textureFunction->sampler))
+ {
+ addressz = "int(max(0, min(layers - 1, floor(0.5 + ";
+ }
+ else if (IsSamplerCube(textureFunction->sampler))
+ {
+ addressz = "((((";
+ }
+ else
+ {
+ addressz = "int(floor(depth * frac((";
+ }
+
+ close = "))))";
+ }
+ }
+ else
+ {
+ switch(hlslCoords)
+ {
+ case 2: out << "float2("; break;
+ case 3: out << "float3("; break;
+ case 4: out << "float4("; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ TString proj = ""; // Only used for projected textures
+
+ if (textureFunction->proj)
+ {
+ switch(textureFunction->coords)
+ {
+ case 3: proj = " / t.z"; break;
+ case 4: proj = " / t.w"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ out << addressx + ("t.x" + proj) + close + ", " + addressy + ("t.y" + proj) + close;
+
</ins><span class="cx"> if (mOutputType == SH_HLSL9_OUTPUT)
</span><span class="cx"> {
</span><del>- out << "float4 gl_textureCubeLod(samplerCUBE s, float3 t, float lod)\n"
- "{\n"
- " return texCUBElod(s, float4(t.x, t.y, t.z, lod));\n"
- "}\n"
- "\n";
</del><ins>+ if (hlslCoords >= 3)
+ {
+ if (textureFunction->coords < 3)
+ {
+ out << ", 0";
+ }
+ else
+ {
+ out << ", t.z" + proj;
+ }
+ }
+
+ if (hlslCoords == 4)
+ {
+ switch(textureFunction->method)
+ {
+ case TextureFunction::BIAS: out << ", bias"; break;
+ case TextureFunction::LOD: out << ", lod"; break;
+ case TextureFunction::LOD0: out << ", 0"; break;
+ case TextureFunction::LOD0BIAS: out << ", bias"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ out << "));\n";
</ins><span class="cx"> }
</span><span class="cx"> else if (mOutputType == SH_HLSL11_OUTPUT)
</span><span class="cx"> {
</span><del>- out << "float4 gl_textureCubeLod(TextureCube t, SamplerState s, float3 uvw, float lod)\n"
- "{\n"
- " return t.SampleLevel(s, uvw, lod);\n"
- "}\n"
- "\n";
</del><ins>+ if (hlslCoords >= 3)
+ {
+ if (IsIntegerSampler(textureFunction->sampler) && IsSamplerCube(textureFunction->sampler))
+ {
+ out << ", face";
+ }
+ else
+ {
+ out << ", " + addressz + ("t.z" + proj) + close;
+ }
+ }
+
+ if (textureFunction->method == TextureFunction::GRAD)
+ {
+ if (IsIntegerSampler(textureFunction->sampler))
+ {
+ out << ", mip)";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ // Compare value
+ switch(textureFunction->coords)
+ {
+ case 3: out << "), t.z"; break;
+ case 4: out << "), t.w"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ out << "), ddx, ddy";
+ }
+ }
+ else if (IsIntegerSampler(textureFunction->sampler) ||
+ textureFunction->method == TextureFunction::FETCH)
+ {
+ out << ", mip)";
+ }
+ else if (IsShadowSampler(textureFunction->sampler))
+ {
+ // Compare value
+ switch(textureFunction->coords)
+ {
+ case 3: out << "), t.z"; break;
+ case 4: out << "), t.w"; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ switch(textureFunction->method)
+ {
+ case TextureFunction::IMPLICIT: out << ")"; break;
+ case TextureFunction::BIAS: out << "), bias"; break;
+ case TextureFunction::LOD: out << "), lod"; break;
+ case TextureFunction::LOD0: out << "), 0"; break;
+ case TextureFunction::LOD0BIAS: out << "), bias"; break;
+ default: UNREACHABLE();
+ }
+ }
+
+ if (textureFunction->offset)
+ {
+ out << ", offset";
+ }
+
+ out << ");";
</ins><span class="cx"> }
</span><span class="cx"> else UNREACHABLE();
</span><span class="cx"> }
</span><ins>+
+ out << "\n"
+ "}\n"
+ "\n";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (mUsesFragCoord)
</span><span class="lines">@@ -1039,67 +1757,90 @@
</span><span class="cx"> {
</span><span class="cx"> TInfoSinkBase &out = mBody;
</span><span class="cx">
</span><ins>+ // Handle accessing std140 structs by value
+ if (mFlaggedStructMappedNames.count(node) > 0)
+ {
+ out << mFlaggedStructMappedNames[node];
+ return;
+ }
+
</ins><span class="cx"> TString name = node->getSymbol();
</span><span class="cx">
</span><del>- if (name == "gl_FragColor")
</del><ins>+ if (name == "gl_DepthRange")
</ins><span class="cx"> {
</span><del>- out << "gl_Color[0]";
- mUsesFragColor = true;
- }
- else if (name == "gl_FragData")
- {
- out << "gl_Color";
- mUsesFragData = true;
- }
- else if (name == "gl_DepthRange")
- {
</del><span class="cx"> mUsesDepthRange = true;
</span><span class="cx"> out << name;
</span><span class="cx"> }
</span><del>- else if (name == "gl_FragCoord")
- {
- mUsesFragCoord = true;
- out << name;
- }
- else if (name == "gl_PointCoord")
- {
- mUsesPointCoord = true;
- out << name;
- }
- else if (name == "gl_FrontFacing")
- {
- mUsesFrontFacing = true;
- out << name;
- }
- else if (name == "gl_PointSize")
- {
- mUsesPointSize = true;
- out << name;
- }
- else if (name == "gl_FragDepthEXT")
- {
- mUsesFragDepth = true;
- out << "gl_Depth";
- }
</del><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> TQualifier qualifier = node->getQualifier();
</span><span class="cx">
</span><span class="cx"> if (qualifier == EvqUniform)
</span><span class="cx"> {
</span><del>- mReferencedUniforms[name] = node;
- out << decorateUniform(name, node->getType());
</del><ins>+ const TType& nodeType = node->getType();
+ const TInterfaceBlock* interfaceBlock = nodeType.getInterfaceBlock();
+
+ if (interfaceBlock)
+ {
+ mReferencedInterfaceBlocks[interfaceBlock->name()] = node;
+ }
+ else
+ {
+ mReferencedUniforms[name] = node;
+ }
+
+ out << decorateUniform(name, nodeType);
</ins><span class="cx"> }
</span><del>- else if (qualifier == EvqAttribute)
</del><ins>+ else if (qualifier == EvqAttribute || qualifier == EvqVertexIn)
</ins><span class="cx"> {
</span><span class="cx"> mReferencedAttributes[name] = node;
</span><span class="cx"> out << decorate(name);
</span><span class="cx"> }
</span><del>- else if (qualifier == EvqVaryingOut || qualifier == EvqInvariantVaryingOut || qualifier == EvqVaryingIn || qualifier == EvqInvariantVaryingIn)
</del><ins>+ else if (isVarying(qualifier))
</ins><span class="cx"> {
</span><span class="cx"> mReferencedVaryings[name] = node;
</span><span class="cx"> out << decorate(name);
</span><span class="cx"> }
</span><ins>+ else if (qualifier == EvqFragmentOut)
+ {
+ mReferencedOutputVariables[name] = node;
+ out << "out_" << name;
+ }
+ else if (qualifier == EvqFragColor)
+ {
+ out << "gl_Color[0]";
+ mUsesFragColor = true;
+ }
+ else if (qualifier == EvqFragData)
+ {
+ out << "gl_Color";
+ mUsesFragData = true;
+ }
+ else if (qualifier == EvqFragCoord)
+ {
+ mUsesFragCoord = true;
+ out << name;
+ }
+ else if (qualifier == EvqPointCoord)
+ {
+ mUsesPointCoord = true;
+ out << name;
+ }
+ else if (qualifier == EvqFrontFacing)
+ {
+ mUsesFrontFacing = true;
+ out << name;
+ }
+ else if (qualifier == EvqPointSize)
+ {
+ mUsesPointSize = true;
+ out << name;
+ }
+ else if (name == "gl_FragDepthEXT")
+ {
+ mUsesFragDepth = true;
+ out << "gl_Depth";
+ }
</ins><span class="cx"> else if (qualifier == EvqInternal)
</span><span class="cx"> {
</span><span class="cx"> out << name;
</span><span class="lines">@@ -1115,6 +1856,13 @@
</span><span class="cx"> {
</span><span class="cx"> TInfoSinkBase &out = mBody;
</span><span class="cx">
</span><ins>+ // Handle accessing std140 structs by value
+ if (mFlaggedStructMappedNames.count(node) > 0)
+ {
+ out << mFlaggedStructMappedNames[node];
+ return false;
+ }
+
</ins><span class="cx"> switch (node->getOp())
</span><span class="cx"> {
</span><span class="cx"> case EOpAssign: outputTriplet(visit, "(", " = ", ")"); break;
</span><span class="lines">@@ -1189,19 +1937,55 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case EOpDivAssign: outputTriplet(visit, "(", " /= ", ")"); break;
</span><del>- case EOpIndexDirect: outputTriplet(visit, "", "[", "]"); break;
- case EOpIndexIndirect: outputTriplet(visit, "", "[", "]"); break;
</del><ins>+ case EOpIndexDirect:
+ {
+ const TType& leftType = node->getLeft()->getType();
+ if (leftType.isInterfaceBlock())
+ {
+ if (visit == PreVisit)
+ {
+ TInterfaceBlock* interfaceBlock = leftType.getInterfaceBlock();
+ const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0);
+
+ mReferencedInterfaceBlocks[interfaceBlock->instanceName()] = node->getLeft()->getAsSymbolNode();
+ out << interfaceBlockInstanceString(*interfaceBlock, arrayIndex);
+
+ return false;
+ }
+ }
+ else
+ {
+ outputTriplet(visit, "", "[", "]");
+ }
+ }
+ break;
+ case EOpIndexIndirect:
+ // We do not currently support indirect references to interface blocks
+ ASSERT(node->getLeft()->getBasicType() != EbtInterfaceBlock);
+ outputTriplet(visit, "", "[", "]");
+ break;
</ins><span class="cx"> case EOpIndexDirectStruct:
</span><span class="cx"> if (visit == InVisit)
</span><span class="cx"> {
</span><span class="cx"> const TStructure* structure = node->getLeft()->getType().getStruct();
</span><span class="cx"> const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion();
</span><span class="cx"> const TField* field = structure->fields()[index->getIConst(0)];
</span><del>- out << "." + decorateField(field->name(), node->getLeft()->getType());
</del><ins>+ out << "." + decorateField(field->name(), *structure);
</ins><span class="cx">
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+ case EOpIndexDirectInterfaceBlock:
+ if (visit == InVisit)
+ {
+ const TInterfaceBlock* interfaceBlock = node->getLeft()->getType().getInterfaceBlock();
+ const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion();
+ const TField* field = interfaceBlock->fields()[index->getIConst(0)];
+ out << "." + decorate(field->name());
+
+ return false;
+ }
+ break;
</ins><span class="cx"> case EOpVectorSwizzle:
</span><span class="cx"> if (visit == InVisit)
</span><span class="cx"> {
</span><span class="lines">@@ -1266,16 +2050,17 @@
</span><span class="cx"> out << "!(";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- const TFieldList &fields = node->getLeft()->getType().getStruct()->fields();
</del><ins>+ const TStructure &structure = *node->getLeft()->getType().getStruct();
+ const TFieldList &fields = structure.fields();
</ins><span class="cx">
</span><span class="cx"> for (size_t i = 0; i < fields.size(); i++)
</span><span class="cx"> {
</span><span class="cx"> const TField *field = fields[i];
</span><span class="cx">
</span><span class="cx"> node->getLeft()->traverse(this);
</span><del>- out << "." + decorateField(field->name(), node->getLeft()->getType()) + " == ";
</del><ins>+ out << "." + decorateField(field->name(), structure) + " == ";
</ins><span class="cx"> node->getRight()->traverse(this);
</span><del>- out << "." + decorateField(field->name(), node->getLeft()->getType());
</del><ins>+ out << "." + decorateField(field->name(), structure);
</ins><span class="cx">
</span><span class="cx"> if (i < fields.size() - 1)
</span><span class="cx"> {
</span><span class="lines">@@ -1354,6 +2139,7 @@
</span><span class="cx"> case EOpPreIncrement: outputTriplet(visit, "(++", "", ")"); break;
</span><span class="cx"> case EOpPreDecrement: outputTriplet(visit, "(--", "", ")"); break;
</span><span class="cx"> case EOpConvIntToBool:
</span><ins>+ case EOpConvUIntToBool:
</ins><span class="cx"> case EOpConvFloatToBool:
</span><span class="cx"> switch (node->getOperand()->getType().getNominalSize())
</span><span class="cx"> {
</span><span class="lines">@@ -1366,6 +2152,7 @@
</span><span class="cx"> break;
</span><span class="cx"> case EOpConvBoolToFloat:
</span><span class="cx"> case EOpConvIntToFloat:
</span><ins>+ case EOpConvUIntToFloat:
</ins><span class="cx"> switch (node->getOperand()->getType().getNominalSize())
</span><span class="cx"> {
</span><span class="cx"> case 1: outputTriplet(visit, "float(", "", ")"); break;
</span><span class="lines">@@ -1377,6 +2164,7 @@
</span><span class="cx"> break;
</span><span class="cx"> case EOpConvFloatToInt:
</span><span class="cx"> case EOpConvBoolToInt:
</span><ins>+ case EOpConvUIntToInt:
</ins><span class="cx"> switch (node->getOperand()->getType().getNominalSize())
</span><span class="cx"> {
</span><span class="cx"> case 1: outputTriplet(visit, "int(", "", ")"); break;
</span><span class="lines">@@ -1386,6 +2174,18 @@
</span><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+ case EOpConvFloatToUInt:
+ case EOpConvBoolToUInt:
+ case EOpConvIntToUInt:
+ switch (node->getOperand()->getType().getNominalSize())
+ {
+ case 1: outputTriplet(visit, "uint(", "", ")"); break;
+ case 2: outputTriplet(visit, "uint2(", "", ")"); break;
+ case 3: outputTriplet(visit, "uint3(", "", ")"); break;
+ case 4: outputTriplet(visit, "uint4(", "", ")"); break;
+ default: UNREACHABLE();
+ }
+ break;
</ins><span class="cx"> case EOpRadians: outputTriplet(visit, "radians(", "", ")"); break;
</span><span class="cx"> case EOpDegrees: outputTriplet(visit, "degrees(", "", ")"); break;
</span><span class="cx"> case EOpSin: outputTriplet(visit, "sin(", "", ")"); break;
</span><span class="lines">@@ -1538,7 +2338,7 @@
</span><span class="cx"> }
</span><span class="cx"> else UNREACHABLE();
</span><span class="cx"> }
</span><del>- else if (variable && (variable->getQualifier() == EvqVaryingOut || variable->getQualifier() == EvqInvariantVaryingOut))
</del><ins>+ else if (variable && isVaryingOut(variable->getQualifier()))
</ins><span class="cx"> {
</span><span class="cx"> for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
</span><span class="cx"> {
</span><span class="lines">@@ -1668,6 +2468,7 @@
</span><span class="cx"> {
</span><span class="cx"> TString name = TFunction::unmangleName(node->getName());
</span><span class="cx"> bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
</span><ins>+ TIntermSequence &arguments = node->getSequence();
</ins><span class="cx">
</span><span class="cx"> if (node->isUserDefined())
</span><span class="cx"> {
</span><span class="lines">@@ -1675,134 +2476,124 @@
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- if (name == "texture2D")
- {
- if (!lod0)
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2D = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2D_bias = true;
- }
- else UNREACHABLE();
</del><ins>+ TBasicType samplerType = arguments[0]->getAsTyped()->getType().getBasicType();
</ins><span class="cx">
</span><del>- out << "gl_texture2D(";
- }
- else
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DLod0_bias = true;
- }
- else UNREACHABLE();
</del><ins>+ TextureFunction textureFunction;
+ textureFunction.sampler = samplerType;
+ textureFunction.coords = arguments[1]->getAsTyped()->getNominalSize();
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.proj = false;
+ textureFunction.offset = false;
</ins><span class="cx">
</span><del>- out << "gl_texture2DLod0(";
- }
</del><ins>+ if (name == "texture2D" || name == "textureCube" || name == "texture")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
</ins><span class="cx"> }
</span><del>- else if (name == "texture2DProj")
</del><ins>+ else if (name == "texture2DProj" || name == "textureProj")
</ins><span class="cx"> {
</span><del>- if (!lod0)
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DProj = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProj_bias = true;
- }
- else UNREACHABLE();
</del><ins>+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.proj = true;
+ }
+ else if (name == "texture2DLod" || name == "textureCubeLod" || name == "textureLod" ||
+ name == "texture2DLodEXT" || name == "textureCubeLodEXT")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ }
+ else if (name == "texture2DProjLod" || name == "textureProjLod" || name == "texture2DProjLodEXT")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ textureFunction.proj = true;
+ }
+ else if (name == "textureSize")
+ {
+ textureFunction.method = TextureFunction::SIZE;
+ }
+ else if (name == "textureOffset")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureProjOffset")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.offset = true;
+ textureFunction.proj = true;
+ }
+ else if (name == "textureLodOffset")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureProjLodOffset")
+ {
+ textureFunction.method = TextureFunction::LOD;
+ textureFunction.proj = true;
+ textureFunction.offset = true;
+ }
+ else if (name == "texelFetch")
+ {
+ textureFunction.method = TextureFunction::FETCH;
+ }
+ else if (name == "texelFetchOffset")
+ {
+ textureFunction.method = TextureFunction::FETCH;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureGrad" || name == "texture2DGradEXT")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ }
+ else if (name == "textureGradOffset")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ textureFunction.offset = true;
+ }
+ else if (name == "textureProjGrad" || name == "texture2DProjGradEXT" || name == "textureCubeGradEXT")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ textureFunction.proj = true;
+ }
+ else if (name == "textureProjGradOffset")
+ {
+ textureFunction.method = TextureFunction::GRAD;
+ textureFunction.proj = true;
+ textureFunction.offset = true;
+ }
+ else UNREACHABLE();
</ins><span class="cx">
</span><del>- out << "gl_texture2DProj(";
- }
- else
</del><ins>+ if (textureFunction.method == TextureFunction::IMPLICIT) // Could require lod 0 or have a bias argument
+ {
+ unsigned int mandatoryArgumentCount = 2; // All functions have sampler and coordinate arguments
+
+ if (textureFunction.offset)
</ins><span class="cx"> {
</span><del>- if (node->getSequence().size() == 2)
- {
- mUsesTexture2DProjLod0 = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProjLod0_bias = true;
- }
- else UNREACHABLE();
-
- out << "gl_texture2DProjLod0(";
</del><ins>+ mandatoryArgumentCount++;
</ins><span class="cx"> }
</span><del>- }
- else if (name == "textureCube")
- {
- if (!lod0)
- {
- if (node->getSequence().size() == 2)
- {
- mUsesTextureCube = true;
- }
- else if (node->getSequence().size() == 3)
- {
- mUsesTextureCube_bias = true;
- }
- else UNREACHABLE();
</del><span class="cx">
</span><del>- out << "gl_textureCube(";
- }
- else
</del><ins>+ bool bias = (arguments.size() > mandatoryArgumentCount); // Bias argument is optional
+
+ if (lod0 || mContext.shaderType == SH_VERTEX_SHADER)
</ins><span class="cx"> {
</span><del>- if (node->getSequence().size() == 2)
</del><ins>+ if (bias)
</ins><span class="cx"> {
</span><del>- mUsesTextureCubeLod0 = true;
</del><ins>+ textureFunction.method = TextureFunction::LOD0BIAS;
</ins><span class="cx"> }
</span><del>- else if (node->getSequence().size() == 3)
</del><ins>+ else
</ins><span class="cx"> {
</span><del>- mUsesTextureCubeLod0_bias = true;
</del><ins>+ textureFunction.method = TextureFunction::LOD0;
</ins><span class="cx"> }
</span><del>- else UNREACHABLE();
-
- out << "gl_textureCubeLod0(";
</del><span class="cx"> }
</span><del>- }
- else if (name == "texture2DLod")
- {
- if (node->getSequence().size() == 3)
</del><ins>+ else if (bias)
</ins><span class="cx"> {
</span><del>- mUsesTexture2DLod = true;
</del><ins>+ textureFunction.method = TextureFunction::BIAS;
</ins><span class="cx"> }
</span><del>- else UNREACHABLE();
-
- out << "gl_texture2DLod(";
</del><span class="cx"> }
</span><del>- else if (name == "texture2DProjLod")
- {
- if (node->getSequence().size() == 3)
- {
- mUsesTexture2DProjLod = true;
- }
- else UNREACHABLE();
</del><span class="cx">
</span><del>- out << "gl_texture2DProjLod(";
- }
- else if (name == "textureCubeLod")
- {
- if (node->getSequence().size() == 3)
- {
- mUsesTextureCubeLod = true;
- }
- else UNREACHABLE();
</del><ins>+ mUsesTexture.insert(textureFunction);
</ins><span class="cx">
</span><del>- out << "gl_textureCubeLod(";
- }
- else UNREACHABLE();
</del><ins>+ out << textureFunction.name();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- TIntermSequence &arguments = node->getSequence();
-
</del><span class="cx"> for (TIntermSequence::iterator arg = arguments.begin(); arg != arguments.end(); arg++)
</span><span class="cx"> {
</span><span class="cx"> if (mOutputType == SH_HLSL11_OUTPUT && IsSampler((*arg)->getAsTyped()->getBasicType()))
</span><span class="lines">@@ -1874,6 +2665,22 @@
</span><span class="cx"> addConstructor(node->getType(), "ivec4", &node->getSequence());
</span><span class="cx"> outputTriplet(visit, "ivec4(", ", ", ")");
</span><span class="cx"> break;
</span><ins>+ case EOpConstructUInt:
+ addConstructor(node->getType(), "uvec1", &node->getSequence());
+ outputTriplet(visit, "uvec1(", "", ")");
+ break;
+ case EOpConstructUVec2:
+ addConstructor(node->getType(), "uvec2", &node->getSequence());
+ outputTriplet(visit, "uvec2(", ", ", ")");
+ break;
+ case EOpConstructUVec3:
+ addConstructor(node->getType(), "uvec3", &node->getSequence());
+ outputTriplet(visit, "uvec3(", ", ", ")");
+ break;
+ case EOpConstructUVec4:
+ addConstructor(node->getType(), "uvec4", &node->getSequence());
+ outputTriplet(visit, "uvec4(", ", ", ")");
+ break;
</ins><span class="cx"> case EOpConstructMat2:
</span><span class="cx"> addConstructor(node->getType(), "mat2", &node->getSequence());
</span><span class="cx"> outputTriplet(visit, "mat2(", ", ", ")");
</span><span class="lines">@@ -1899,8 +2706,9 @@
</span><span class="cx"> case EOpMod:
</span><span class="cx"> {
</span><span class="cx"> // We need to look at the number of components in both arguments
</span><del>- switch (node->getSequence()[0]->getAsTyped()->getNominalSize() * 10
- + node->getSequence()[1]->getAsTyped()->getNominalSize())
</del><ins>+ const int modValue = node->getSequence()[0]->getAsTyped()->getNominalSize() * 10
+ + node->getSequence()[1]->getAsTyped()->getNominalSize();
+ switch (modValue)
</ins><span class="cx"> {
</span><span class="cx"> case 11: mUsesMod1 = true; break;
</span><span class="cx"> case 22: mUsesMod2v = true; break;
</span><span class="lines">@@ -2028,6 +2836,8 @@
</span><span class="cx">
</span><span class="cx"> bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
</span><span class="cx"> {
</span><ins>+ mNestedLoopDepth++;
+
</ins><span class="cx"> bool wasDiscontinuous = mInsideDiscontinuousLoop;
</span><span class="cx">
</span><span class="cx"> if (mContainsLoopDiscontinuity && !mInsideDiscontinuousLoop)
</span><span class="lines">@@ -2039,6 +2849,9 @@
</span><span class="cx"> {
</span><span class="cx"> if (handleExcessiveLoop(node))
</span><span class="cx"> {
</span><ins>+ mInsideDiscontinuousLoop = wasDiscontinuous;
+ mNestedLoopDepth--;
+
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2102,6 +2915,7 @@
</span><span class="cx"> out << "}\n";
</span><span class="cx">
</span><span class="cx"> mInsideDiscontinuousLoop = wasDiscontinuous;
</span><ins>+ mNestedLoopDepth--;
</ins><span class="cx">
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -2118,6 +2932,11 @@
</span><span class="cx"> case EOpBreak:
</span><span class="cx"> if (visit == PreVisit)
</span><span class="cx"> {
</span><ins>+ if (mNestedLoopDepth > 1)
+ {
+ mUsesNestedBreak = true;
+ }
+
</ins><span class="cx"> if (mExcessiveLoopIndex)
</span><span class="cx"> {
</span><span class="cx"> out << "{Break";
</span><span class="lines">@@ -2230,7 +3049,7 @@
</span><span class="cx">
</span><span class="cx"> if (symbol && constant)
</span><span class="cx"> {
</span><del>- if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
</del><ins>+ if (constant->getBasicType() == EbtInt && constant->isScalar())
</ins><span class="cx"> {
</span><span class="cx"> index = symbol;
</span><span class="cx"> initial = constant->getIConst(0);
</span><span class="lines">@@ -2252,7 +3071,7 @@
</span><span class="cx">
</span><span class="cx"> if (constant)
</span><span class="cx"> {
</span><del>- if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
</del><ins>+ if (constant->getBasicType() == EbtInt && constant->isScalar())
</ins><span class="cx"> {
</span><span class="cx"> comparator = test->getOp();
</span><span class="cx"> limit = constant->getIConst(0);
</span><span class="lines">@@ -2274,7 +3093,7 @@
</span><span class="cx">
</span><span class="cx"> if (constant)
</span><span class="cx"> {
</span><del>- if (constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
</del><ins>+ if (constant->getBasicType() == EbtInt && constant->isScalar())
</ins><span class="cx"> {
</span><span class="cx"> int value = constant->getIConst(0);
</span><span class="cx">
</span><span class="lines">@@ -2450,13 +3269,35 @@
</span><span class="cx">
</span><span class="cx"> if (mOutputType == SH_HLSL11_OUTPUT && IsSampler(type.getBasicType()))
</span><span class="cx"> {
</span><del>- return qualifierString(qualifier) + " " + textureString(type) + " texture_" + name + arrayString(type) + ", " +
- qualifierString(qualifier) + " SamplerState sampler_" + name + arrayString(type);
</del><ins>+ return qualifierString(qualifier) + " " + textureString(type) + " texture_" + name + arrayString(type) + ", " +
+ qualifierString(qualifier) + " " + samplerString(type) + " sampler_" + name + arrayString(type);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return qualifierString(qualifier) + " " + typeString(type) + " " + name + arrayString(type);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TString OutputHLSL::interpolationString(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqVaryingIn: return "";
+ case EvqFragmentIn: return "";
+ case EvqInvariantVaryingIn: return "";
+ case EvqSmoothIn: return "linear";
+ case EvqFlatIn: return "nointerpolation";
+ case EvqCentroidIn: return "centroid";
+ case EvqVaryingOut: return "";
+ case EvqVertexOut: return "";
+ case EvqInvariantVaryingOut: return "";
+ case EvqSmoothOut: return "linear";
+ case EvqFlatOut: return "nointerpolation";
+ case EvqCentroidOut: return "centroid";
+ default: UNREACHABLE();
+ }
+
+ return "";
+}
+
</ins><span class="cx"> TString OutputHLSL::qualifierString(TQualifier qualifier)
</span><span class="cx"> {
</span><span class="cx"> switch(qualifier)
</span><span class="lines">@@ -2473,40 +3314,24 @@
</span><span class="cx">
</span><span class="cx"> TString OutputHLSL::typeString(const TType &type)
</span><span class="cx"> {
</span><del>- if (type.getBasicType() == EbtStruct)
</del><ins>+ const TStructure* structure = type.getStruct();
+ if (structure)
</ins><span class="cx"> {
</span><del>- const TString& typeName = type.getStruct()->name();
</del><ins>+ const TString& typeName = structure->name();
</ins><span class="cx"> if (typeName != "")
</span><span class="cx"> {
</span><span class="cx"> return structLookup(typeName);
</span><span class="cx"> }
</span><span class="cx"> else // Nameless structure, define in place
</span><span class="cx"> {
</span><del>- const TFieldList &fields = type.getStruct()->fields();
-
- TString string = "struct\n"
- "{\n";
-
- for (unsigned int i = 0; i < fields.size(); i++)
- {
- const TField *field = fields[i];
-
- string += " " + typeString(*field->type()) + " " + decorate(field->name()) + arrayString(*field->type()) + ";\n";
- }
-
- string += "} ";
-
- return string;
</del><ins>+ return structureString(*structure, false, false);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> else if (type.isMatrix())
</span><span class="cx"> {
</span><del>- switch (type.getNominalSize())
- {
- case 2: return "float2x2";
- case 3: return "float3x3";
- case 4: return "float4x4";
- }
</del><ins>+ int cols = type.getCols();
+ int rows = type.getRows();
+ return "float" + str(cols) + "x" + str(rows);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -2528,6 +3353,14 @@
</span><span class="cx"> case 3: return "int3";
</span><span class="cx"> case 4: return "int4";
</span><span class="cx"> }
</span><ins>+ case EbtUInt:
+ switch (type.getNominalSize())
+ {
+ case 1: return "uint";
+ case 2: return "uint2";
+ case 3: return "uint3";
+ case 4: return "uint4";
+ }
</ins><span class="cx"> case EbtBool:
</span><span class="cx"> switch (type.getNominalSize())
</span><span class="cx"> {
</span><span class="lines">@@ -2539,8 +3372,15 @@
</span><span class="cx"> case EbtVoid:
</span><span class="cx"> return "void";
</span><span class="cx"> case EbtSampler2D:
</span><ins>+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
</ins><span class="cx"> return "sampler2D";
</span><span class="cx"> case EbtSamplerCube:
</span><ins>+ case EbtISamplerCube:
+ case EbtUSamplerCube:
</ins><span class="cx"> return "samplerCUBE";
</span><span class="cx"> case EbtSamplerExternalOES:
</span><span class="cx"> return "sampler2D";
</span><span class="lines">@@ -2557,20 +3397,40 @@
</span><span class="cx"> {
</span><span class="cx"> switch (type.getBasicType())
</span><span class="cx"> {
</span><del>- case EbtSampler2D:
- return "Texture2D";
- case EbtSamplerCube:
- return "TextureCube";
- case EbtSamplerExternalOES:
- return "Texture2D";
- default:
- break;
</del><ins>+ case EbtSampler2D: return "Texture2D";
+ case EbtSamplerCube: return "TextureCube";
+ case EbtSamplerExternalOES: return "Texture2D";
+ case EbtSampler2DArray: return "Texture2DArray";
+ case EbtSampler3D: return "Texture3D";
+ case EbtISampler2D: return "Texture2D<int4>";
+ case EbtISampler3D: return "Texture3D<int4>";
+ case EbtISamplerCube: return "Texture2DArray<int4>";
+ case EbtISampler2DArray: return "Texture2DArray<int4>";
+ case EbtUSampler2D: return "Texture2D<uint4>";
+ case EbtUSampler3D: return "Texture3D<uint4>";
+ case EbtUSamplerCube: return "Texture2DArray<uint4>";
+ case EbtUSampler2DArray: return "Texture2DArray<uint4>";
+ case EbtSampler2DShadow: return "Texture2D";
+ case EbtSamplerCubeShadow: return "TextureCube";
+ case EbtSampler2DArrayShadow: return "Texture2DArray";
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>-
- UNREACHABLE();
</del><ins>+
</ins><span class="cx"> return "<unknown texture type>";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TString OutputHLSL::samplerString(const TType &type)
+{
+ if (IsShadowSampler(type.getBasicType()))
+ {
+ return "SamplerComparisonState";
+ }
+ else
+ {
+ return "SamplerState";
+ }
+}
+
</ins><span class="cx"> TString OutputHLSL::arrayString(const TType &type)
</span><span class="cx"> {
</span><span class="cx"> if (!type.isArray())
</span><span class="lines">@@ -2599,6 +3459,77 @@
</span><span class="cx"> return "{" + string + "}";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TString OutputHLSL::structureString(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
+{
+ const TFieldList &fields = structure.fields();
+ const bool isNameless = (structure.name() == "");
+ const TString &structName = structureTypeName(structure, useHLSLRowMajorPacking, useStd140Packing);
+ const TString declareString = (isNameless ? "struct" : "struct " + structName);
+
+ TString string;
+ string += declareString + "\n"
+ "{\n";
+
+ int elementIndex = 0;
+
+ for (unsigned int i = 0; i < fields.size(); i++)
+ {
+ const TField &field = *fields[i];
+ const TType &fieldType = *field.type();
+ const TStructure *fieldStruct = fieldType.getStruct();
+ const TString &fieldTypeString = fieldStruct ? structureTypeName(*fieldStruct, useHLSLRowMajorPacking, useStd140Packing) : typeString(fieldType);
+
+ if (useStd140Packing)
+ {
+ string += std140PrePaddingString(*field.type(), &elementIndex);
+ }
+
+ string += " " + fieldTypeString + " " + decorateField(field.name(), structure) + arrayString(fieldType) + ";\n";
+
+ if (useStd140Packing)
+ {
+ string += std140PostPaddingString(*field.type(), useHLSLRowMajorPacking);
+ }
+ }
+
+ // Nameless structs do not finish with a semicolon and newline, to leave room for an instance variable
+ string += (isNameless ? "} " : "};\n");
+
+ // Add remaining element index to the global map, for use with nested structs in standard layouts
+ if (useStd140Packing)
+ {
+ mStd140StructElementIndexes[structName] = elementIndex;
+ }
+
+ return string;
+}
+
+TString OutputHLSL::structureTypeName(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
+{
+ if (structure.name() == "")
+ {
+ return "";
+ }
+
+ TString prefix = "";
+
+ // Structs packed with row-major matrices in HLSL are prefixed with "rm"
+ // GLSL column-major maps to HLSL row-major, and the converse is true
+
+ if (useStd140Packing)
+ {
+ prefix += "std";
+ }
+
+ if (useHLSLRowMajorPacking)
+ {
+ if (prefix != "") prefix += "_";
+ prefix += "rm";
+ }
+
+ return prefix + structLookup(structure.name());
+}
+
</ins><span class="cx"> void OutputHLSL::addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters)
</span><span class="cx"> {
</span><span class="cx"> if (name == "")
</span><span class="lines">@@ -2621,30 +3552,32 @@
</span><span class="cx"> typedef std::vector<TType> ParameterArray;
</span><span class="cx"> ParameterArray ctorParameters;
</span><span class="cx">
</span><del>- if (type.getStruct())
</del><ins>+ const TStructure* structure = type.getStruct();
+ if (structure)
</ins><span class="cx"> {
</span><span class="cx"> mStructNames.insert(decorate(name));
</span><span class="cx">
</span><del>- TString structure;
- structure += "struct " + decorate(name) + "\n"
- "{\n";
</del><ins>+ const TString &structString = structureString(*structure, false, false);
</ins><span class="cx">
</span><del>- const TFieldList &fields = type.getStruct()->fields();
-
- for (unsigned int i = 0; i < fields.size(); i++)
</del><ins>+ if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structString) == mStructDeclarations.end())
</ins><span class="cx"> {
</span><del>- const TField *field = fields[i];
</del><ins>+ // Add row-major packed struct for interface blocks
+ TString rowMajorString = "#pragma pack_matrix(row_major)\n" +
+ structureString(*structure, true, false) +
+ "#pragma pack_matrix(column_major)\n";
</ins><span class="cx">
</span><del>- structure += " " + typeString(*field->type()) + " " + decorateField(field->name(), type) + arrayString(*field->type()) + ";\n";
- }
</del><ins>+ TString std140String = structureString(*structure, false, true);
+ TString std140RowMajorString = "#pragma pack_matrix(row_major)\n" +
+ structureString(*structure, true, true) +
+ "#pragma pack_matrix(column_major)\n";
</ins><span class="cx">
</span><del>- structure += "};\n";
-
- if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structure) == mStructDeclarations.end())
- {
- mStructDeclarations.push_back(structure);
</del><ins>+ mStructDeclarations.push_back(structString);
+ mStructDeclarations.push_back(rowMajorString);
+ mStructDeclarations.push_back(std140String);
+ mStructDeclarations.push_back(std140RowMajorString);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ const TFieldList &fields = structure->fields();
</ins><span class="cx"> for (unsigned int i = 0; i < fields.size(); i++)
</span><span class="cx"> {
</span><span class="cx"> ctorParameters.push_back(*fields[i]->type());
</span><span class="lines">@@ -2696,18 +3629,19 @@
</span><span class="cx">
</span><span class="cx"> if (ctorType.isMatrix() && ctorParameters.size() == 1)
</span><span class="cx"> {
</span><del>- int dim = ctorType.getNominalSize();
</del><ins>+ int rows = ctorType.getRows();
+ int cols = ctorType.getCols();
</ins><span class="cx"> const TType &parameter = ctorParameters[0];
</span><span class="cx">
</span><span class="cx"> if (parameter.isScalar())
</span><span class="cx"> {
</span><del>- for (int row = 0; row < dim; row++)
</del><ins>+ for (int row = 0; row < rows; row++)
</ins><span class="cx"> {
</span><del>- for (int col = 0; col < dim; col++)
</del><ins>+ for (int col = 0; col < cols; col++)
</ins><span class="cx"> {
</span><span class="cx"> constructor += TString((row == col) ? "x0" : "0.0");
</span><span class="cx">
</span><del>- if (row < dim - 1 || col < dim - 1)
</del><ins>+ if (row < rows - 1 || col < cols - 1)
</ins><span class="cx"> {
</span><span class="cx"> constructor += ", ";
</span><span class="cx"> }
</span><span class="lines">@@ -2716,11 +3650,11 @@
</span><span class="cx"> }
</span><span class="cx"> else if (parameter.isMatrix())
</span><span class="cx"> {
</span><del>- for (int row = 0; row < dim; row++)
</del><ins>+ for (int row = 0; row < rows; row++)
</ins><span class="cx"> {
</span><del>- for (int col = 0; col < dim; col++)
</del><ins>+ for (int col = 0; col < cols; col++)
</ins><span class="cx"> {
</span><del>- if (row < parameter.getNominalSize() && col < parameter.getNominalSize())
</del><ins>+ if (row < parameter.getRows() && col < parameter.getCols())
</ins><span class="cx"> {
</span><span class="cx"> constructor += TString("x0") + "[" + str(row) + "]" + "[" + str(col) + "]";
</span><span class="cx"> }
</span><span class="lines">@@ -2729,7 +3663,7 @@
</span><span class="cx"> constructor += TString((row == col) ? "1.0" : "0.0");
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (row < dim - 1 || col < dim - 1)
</del><ins>+ if (row < rows - 1 || col < cols - 1)
</ins><span class="cx"> {
</span><span class="cx"> constructor += ", ";
</span><span class="cx"> }
</span><span class="lines">@@ -2753,8 +3687,7 @@
</span><span class="cx">
</span><span class="cx"> if (parameter.isScalar())
</span><span class="cx"> {
</span><del>- ASSERT(parameterSize <= remainingComponents);
- remainingComponents -= parameterSize;
</del><ins>+ remainingComponents -= parameter.getObjectSize();
</ins><span class="cx"> }
</span><span class="cx"> else if (parameter.isVector())
</span><span class="cx"> {
</span><span class="lines">@@ -2818,11 +3751,12 @@
</span><span class="cx"> {
</span><span class="cx"> TInfoSinkBase &out = mBody;
</span><span class="cx">
</span><del>- if (type.getBasicType() == EbtStruct)
</del><ins>+ const TStructure* structure = type.getStruct();
+ if (structure)
</ins><span class="cx"> {
</span><del>- out << structLookup(type.getStruct()->name()) + "_ctor(";
</del><ins>+ out << structLookup(structure->name()) + "_ctor(";
</ins><span class="cx">
</span><del>- const TFieldList &fields = type.getStruct()->fields();
</del><ins>+ const TFieldList& fields = structure->fields();
</ins><span class="cx">
</span><span class="cx"> for (size_t i = 0; i < fields.size(); i++)
</span><span class="cx"> {
</span><span class="lines">@@ -2854,6 +3788,7 @@
</span><span class="cx"> {
</span><span class="cx"> case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break;
</span><span class="cx"> case EbtInt: out << constUnion->getIConst(); break;
</span><ins>+ case EbtUInt: out << constUnion->getUConst(); break;
</ins><span class="cx"> case EbtBool: out << constUnion->getBConst(); break;
</span><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="lines">@@ -2935,9 +3870,9 @@
</span><span class="cx"> return decorate(string);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TString OutputHLSL::decorateField(const TString &string, const TType &structure)
</del><ins>+TString OutputHLSL::decorateField(const TString &string, const TStructure &structure)
</ins><span class="cx"> {
</span><del>- if (structure.getStruct()->name().compare(0, 3, "gl_") != 0)
</del><ins>+ if (structure.name().compare(0, 3, "gl_") != 0)
</ins><span class="cx"> {
</span><span class="cx"> return decorate(string);
</span><span class="cx"> }
</span><span class="lines">@@ -2945,86 +3880,144 @@
</span><span class="cx"> return string;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TString OutputHLSL::registerString(TIntermSymbol *operand)
</del><ins>+void OutputHLSL::declareInterfaceBlockField(const TType &type, const TString &name, std::vector<gl::InterfaceBlockField>& output)
</ins><span class="cx"> {
</span><del>- ASSERT(operand->getQualifier() == EvqUniform);
</del><ins>+ const TStructure *structure = type.getStruct();
</ins><span class="cx">
</span><del>- if (IsSampler(operand->getBasicType()))
</del><ins>+ if (!structure)
</ins><span class="cx"> {
</span><del>- return "s" + str(samplerRegister(operand));
</del><ins>+ const bool isRowMajorMatrix = (type.isMatrix() && 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);
+
+ const TFieldList &fields = structure->fields();
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ TField *field = fields[fieldIndex];
+ TType *fieldType = field->type();
+
+ // make sure to copy matrix packing information
+ fieldType->setLayoutQualifier(type.getLayoutQualifier());
+
+ declareInterfaceBlockField(*fieldType, field->name(), structField.fields);
+ }
+
+ output.push_back(structField);
</ins><span class="cx"> }
</span><del>-
- return "c" + str(uniformRegister(operand));
</del><span class="cx"> }
</span><span class="cx">
</span><del>-int OutputHLSL::samplerRegister(TIntermSymbol *sampler)
</del><ins>+gl::Uniform OutputHLSL::declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<gl::Uniform>& output)
</ins><span class="cx"> {
</span><del>- const TType &type = sampler->getType();
- ASSERT(IsSampler(type.getBasicType()));
</del><ins>+ const TStructure *structure = type.getStruct();
</ins><span class="cx">
</span><del>- int index = mSamplerRegister;
- mSamplerRegister += sampler->totalRegisterCount();
</del><ins>+ if (!structure)
+ {
+ gl::Uniform uniform(glVariableType(type), glVariablePrecision(type), name.c_str(),
+ (unsigned int)type.getArraySize(), (unsigned int)registerIndex, 0);
+ output.push_back(uniform);
</ins><span class="cx">
</span><del>- declareUniform(type, sampler->getSymbol(), index);
</del><ins>+ return uniform;
+ }
+ else
+ {
+ gl::Uniform structUniform(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(),
+ (unsigned int)registerIndex, GL_INVALID_INDEX);
</ins><span class="cx">
</span><del>- return index;
</del><ins>+ const TFieldList &fields = structure->fields();
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ TField *field = fields[fieldIndex];
+ TType *fieldType = field->type();
+
+ declareUniformToList(*fieldType, field->name(), GL_INVALID_INDEX, structUniform.fields);
+ }
+
+ // assign register offset information -- this will override the information in any sub-structures.
+ HLSLVariableGetRegisterInfo(registerIndex, &structUniform);
+
+ output.push_back(structUniform);
+
+ return structUniform;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-int OutputHLSL::uniformRegister(TIntermSymbol *uniform)
</del><ins>+gl::InterpolationType getInterpolationType(TQualifier qualifier)
</ins><span class="cx"> {
</span><del>- const TType &type = uniform->getType();
- ASSERT(!IsSampler(type.getBasicType()));
</del><ins>+ switch (qualifier)
+ {
+ case EvqFlatIn:
+ case EvqFlatOut:
+ return gl::INTERPOLATION_FLAT;
</ins><span class="cx">
</span><del>- int index = mUniformRegister;
- mUniformRegister += uniform->totalRegisterCount();
</del><ins>+ case EvqSmoothIn:
+ case EvqSmoothOut:
+ case EvqVertexOut:
+ case EvqFragmentIn:
+ case EvqVaryingIn:
+ case EvqVaryingOut:
+ return gl::INTERPOLATION_SMOOTH;
</ins><span class="cx">
</span><del>- declareUniform(type, uniform->getSymbol(), index);
</del><ins>+ case EvqCentroidIn:
+ case EvqCentroidOut:
+ return gl::INTERPOLATION_CENTROID;
</ins><span class="cx">
</span><del>- return index;
</del><ins>+ default: UNREACHABLE();
+ return gl::INTERPOLATION_SMOOTH;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void OutputHLSL::declareUniform(const TType &type, const TString &name, int index)
</del><ins>+void OutputHLSL::declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<gl::Varying>& fieldsOut)
</ins><span class="cx"> {
</span><del>- TStructure *structure = type.getStruct();
</del><ins>+ const TStructure *structure = type.getStruct();
</ins><span class="cx">
</span><ins>+ gl::InterpolationType interpolation = getInterpolationType(baseTypeQualifier);
</ins><span class="cx"> if (!structure)
</span><span class="cx"> {
</span><del>- mActiveUniforms.push_back(Uniform(glVariableType(type), glVariablePrecision(type), name.c_str(), type.getArraySize(), index));
</del><ins>+ gl::Varying varying(glVariableType(type), glVariablePrecision(type), name.c_str(), (unsigned int)type.getArraySize(), interpolation);
+ fieldsOut.push_back(varying);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><ins>+ gl::Varying structVarying(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(), interpolation);
</ins><span class="cx"> const TFieldList &fields = structure->fields();
</span><span class="cx">
</span><del>- if (type.isArray())
</del><ins>+ structVarying.structName = structure->name().c_str();
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
</ins><span class="cx"> {
</span><del>- int elementIndex = index;
-
- for (int i = 0; i < type.getArraySize(); i++)
- {
- for (size_t j = 0; j < fields.size(); j++)
- {
- const TType &fieldType = *fields[j]->type();
- const TString uniformName = name + "[" + str(i) + "]." + fields[j]->name();
- declareUniform(fieldType, uniformName, elementIndex);
- elementIndex += fieldType.totalRegisterCount();
- }
- }
</del><ins>+ const TField &field = *fields[fieldIndex];
+ declareVaryingToList(*field.type(), baseTypeQualifier, field.name(), structVarying.fields);
</ins><span class="cx"> }
</span><del>- else
- {
- int fieldIndex = index;
</del><span class="cx">
</span><del>- for (size_t i = 0; i < fields.size(); i++)
- {
- const TType &fieldType = *fields[i]->type();
- const TString uniformName = name + "." + fields[i]->name();
- declareUniform(fieldType, uniformName, fieldIndex);
- fieldIndex += fieldType.totalRegisterCount();
- }
- }
</del><ins>+ fieldsOut.push_back(structVarying);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int OutputHLSL::declareUniformAndAssignRegister(const TType &type, const TString &name)
+{
+ int registerIndex = (IsSampler(type.getBasicType()) ? mSamplerRegister : mUniformRegister);
+
+ const gl::Uniform &uniform = declareUniformToList(type, name, registerIndex, mActiveUniforms);
+
+ if (IsSampler(type.getBasicType()))
+ {
+ mSamplerRegister += gl::HLSLVariableRegisterCount(uniform);
+ }
+ else
+ {
+ mUniformRegister += gl::HLSLVariableRegisterCount(uniform);
+ }
+
+ return registerIndex;
+}
+
</ins><span class="cx"> GLenum OutputHLSL::glVariableType(const TType &type)
</span><span class="cx"> {
</span><span class="cx"> if (type.getBasicType() == EbtFloat)
</span><span class="lines">@@ -3045,11 +4038,35 @@
</span><span class="cx"> }
</span><span class="cx"> else if (type.isMatrix())
</span><span class="cx"> {
</span><del>- switch(type.getNominalSize())
</del><ins>+ switch (type.getCols())
</ins><span class="cx"> {
</span><del>- case 2: return GL_FLOAT_MAT2;
- case 3: return GL_FLOAT_MAT3;
- case 4: return GL_FLOAT_MAT4;
</del><ins>+ 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();
+ }
+
</ins><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3073,6 +4090,24 @@
</span><span class="cx"> }
</span><span class="cx"> else UNREACHABLE();
</span><span class="cx"> }
</span><ins>+ 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();
+ }
</ins><span class="cx"> else if (type.getBasicType() == EbtBool)
</span><span class="cx"> {
</span><span class="cx"> if (type.isScalar())
</span><span class="lines">@@ -3091,15 +4126,26 @@
</span><span class="cx"> }
</span><span class="cx"> else UNREACHABLE();
</span><span class="cx"> }
</span><del>- else if (type.getBasicType() == EbtSampler2D)
</del><ins>+
+ switch(type.getBasicType())
</ins><span class="cx"> {
</span><del>- return GL_SAMPLER_2D;
</del><ins>+ 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();
</ins><span class="cx"> }
</span><del>- else if (type.getBasicType() == EbtSamplerCube)
- {
- return GL_SAMPLER_CUBE;
- }
- else UNREACHABLE();
</del><span class="cx">
</span><span class="cx"> return GL_NONE;
</span><span class="cx"> }
</span><span class="lines">@@ -3118,7 +4164,7 @@
</span><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (type.getBasicType() == EbtInt)
</del><ins>+ else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
</ins><span class="cx"> {
</span><span class="cx"> switch (type.getPrecision())
</span><span class="cx"> {
</span><span class="lines">@@ -3135,4 +4181,45 @@
</span><span class="cx"> return GL_NONE;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool OutputHLSL::isVaryingOut(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqVaryingOut:
+ case EvqInvariantVaryingOut:
+ case EvqSmoothOut:
+ case EvqFlatOut:
+ case EvqCentroidOut:
+ case EvqVertexOut:
+ return true;
+
+ default: break;
+ }
+
+ return false;
</ins><span class="cx"> }
</span><ins>+
+bool OutputHLSL::isVaryingIn(TQualifier qualifier)
+{
+ switch(qualifier)
+ {
+ case EvqVaryingIn:
+ case EvqInvariantVaryingIn:
+ case EvqSmoothIn:
+ case EvqFlatIn:
+ case EvqCentroidIn:
+ case EvqFragmentIn:
+ return true;
+
+ default: break;
+ }
+
+ return false;
+}
+
+bool OutputHLSL::isVarying(TQualifier qualifier)
+{
+ return isVaryingIn(qualifier) || isVaryingOut(qualifier);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputHLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.h        2014-04-30 22:57:08 UTC (rev 168055)
</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,11 +12,12 @@
</span><span class="cx"> #include <map>
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx"> #include "compiler/translator/ParseContext.h"
</span><del>-#include "compiler/translator/Uniform.h"
</del><ins>+#include "common/shadervars.h"
</ins><span class="cx">
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="lines">@@ -31,16 +32,24 @@
</span><span class="cx"> void output();
</span><span class="cx">
</span><span class="cx"> TInfoSinkBase &getBodyStream();
</span><del>- const ActiveUniforms &getUniforms();
</del><ins>+ const std::vector<gl::Uniform> &getUniforms();
+ const std::vector<gl::InterfaceBlock> &getInterfaceBlocks() const;
+ const std::vector<gl::Attribute> &getOutputVariables() const;
+ const std::vector<gl::Attribute> &getAttributes() const;
+ const std::vector<gl::Varying> &getVaryings() const;
</ins><span class="cx">
</span><span class="cx"> TString typeString(const TType &type);
</span><span class="cx"> TString textureString(const TType &type);
</span><ins>+ TString samplerString(const TType &type);
+ TString interpolationString(TQualifier qualifier);
+ TString structureString(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
+ TString structureTypeName(const TStructure &structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
</ins><span class="cx"> static TString qualifierString(TQualifier qualifier);
</span><span class="cx"> static TString arrayString(const TType &type);
</span><span class="cx"> static TString initializer(const TType &type);
</span><span class="cx"> static TString decorate(const TString &string); // Prepends an underscore to avoid naming clashes
</span><span class="cx"> static TString decorateUniform(const TString &string, const TType &type);
</span><del>- static TString decorateField(const TString &string, const TType &structure);
</del><ins>+ static TString decorateField(const TString &string, const TStructure &structure);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> void header();
</span><span class="lines">@@ -82,25 +91,40 @@
</span><span class="cx">
</span><span class="cx"> typedef std::map<TString, TIntermSymbol*> ReferencedSymbols;
</span><span class="cx"> ReferencedSymbols mReferencedUniforms;
</span><ins>+ ReferencedSymbols mReferencedInterfaceBlocks;
</ins><span class="cx"> ReferencedSymbols mReferencedAttributes;
</span><span class="cx"> ReferencedSymbols mReferencedVaryings;
</span><ins>+ ReferencedSymbols mReferencedOutputVariables;
</ins><span class="cx">
</span><ins>+ struct TextureFunction
+ {
+ enum Method
+ {
+ IMPLICIT, // Mipmap LOD determined implicitly (standard lookup)
+ BIAS,
+ LOD,
+ LOD0,
+ LOD0BIAS,
+ SIZE, // textureSize()
+ FETCH,
+ GRAD
+ };
+
+ TBasicType sampler;
+ int coords;
+ bool proj;
+ bool offset;
+ Method method;
+
+ TString name() const;
+
+ bool operator<(const TextureFunction &rhs) const;
+ };
+
+ typedef std::set<TextureFunction> TextureFunctionSet;
+
</ins><span class="cx"> // Parameters determining what goes in the header output
</span><del>- bool mUsesTexture2D;
- bool mUsesTexture2D_bias;
- bool mUsesTexture2DLod;
- bool mUsesTexture2DProj;
- bool mUsesTexture2DProj_bias;
- bool mUsesTexture2DProjLod;
- bool mUsesTextureCube;
- bool mUsesTextureCube_bias;
- bool mUsesTextureCubeLod;
- bool mUsesTexture2DLod0;
- bool mUsesTexture2DLod0_bias;
- bool mUsesTexture2DProjLod0;
- bool mUsesTexture2DProjLod0_bias;
- bool mUsesTextureCubeLod0;
- bool mUsesTextureCubeLod0_bias;
</del><ins>+ TextureFunctionSet mUsesTexture;
</ins><span class="cx"> bool mUsesFragColor;
</span><span class="cx"> bool mUsesFragData;
</span><span class="cx"> bool mUsesDepthRange;
</span><span class="lines">@@ -126,6 +150,7 @@
</span><span class="cx"> bool mUsesAtan2_3;
</span><span class="cx"> bool mUsesAtan2_4;
</span><span class="cx"> bool mUsesDiscardRewriting;
</span><ins>+ bool mUsesNestedBreak;
</ins><span class="cx">
</span><span class="cx"> int mNumRenderTargets;
</span><span class="cx">
</span><span class="lines">@@ -147,20 +172,54 @@
</span><span class="cx"> bool mContainsLoopDiscontinuity;
</span><span class="cx"> bool mOutputLod0Function;
</span><span class="cx"> bool mInsideDiscontinuousLoop;
</span><ins>+ int mNestedLoopDepth;
</ins><span class="cx">
</span><span class="cx"> TIntermSymbol *mExcessiveLoopIndex;
</span><span class="cx">
</span><span class="cx"> int mUniformRegister;
</span><ins>+ int mInterfaceBlockRegister;
</ins><span class="cx"> int mSamplerRegister;
</span><ins>+ int mPaddingCounter;
</ins><span class="cx">
</span><span class="cx"> TString registerString(TIntermSymbol *operand);
</span><span class="cx"> int samplerRegister(TIntermSymbol *sampler);
</span><span class="cx"> int uniformRegister(TIntermSymbol *uniform);
</span><ins>+ void declareInterfaceBlockField(const TType &type, const TString &name, std::vector<gl::InterfaceBlockField>& output);
+ gl::Uniform declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<gl::Uniform>& output);
</ins><span class="cx"> void declareUniform(const TType &type, const TString &name, int index);
</span><ins>+ void declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<gl::Varying>& fieldsOut);
+
+ // Returns the uniform's register index
+ int declareUniformAndAssignRegister(const TType &type, const TString &name);
+
+ TString interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, const TField &field);
+ TString decoratePrivate(const TString &privateText);
+ TString interfaceBlockStructNameString(const TInterfaceBlock &interfaceBlockType);
+ TString interfaceBlockInstanceString(const TInterfaceBlock& interfaceBlock, unsigned int arrayIndex);
+ TString interfaceBlockFieldTypeString(const TField &field, TLayoutBlockStorage blockStorage);
+ TString interfaceBlockFieldString(const TInterfaceBlock &interfaceBlock, TLayoutBlockStorage blockStorage);
+ TString interfaceBlockStructString(const TInterfaceBlock &interfaceBlock);
+ TString interfaceBlockString(const TInterfaceBlock &interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex);
+ TString std140PrePaddingString(const TType &type, int *elementIndex);
+ TString std140PostPaddingString(const TType &type, bool useHLSLRowMajorPacking);
+ TString structInitializerString(int indent, const TStructure &structure, const TString &rhsStructName);
+
</ins><span class="cx"> static GLenum glVariableType(const TType &type);
</span><span class="cx"> static GLenum glVariablePrecision(const TType &type);
</span><ins>+ static bool isVaryingIn(TQualifier qualifier);
+ static bool isVaryingOut(TQualifier qualifier);
+ static bool isVarying(TQualifier qualifier);
</ins><span class="cx">
</span><del>- ActiveUniforms mActiveUniforms;
</del><ins>+ std::vector<gl::Uniform> mActiveUniforms;
+ std::vector<gl::InterfaceBlock> mActiveInterfaceBlocks;
+ std::vector<gl::Attribute> mActiveOutputVariables;
+ std::vector<gl::Attribute> mActiveAttributes;
+ std::vector<gl::Varying> mActiveVaryings;
+ std::map<TString, int> mStd140StructElementIndexes;
+ std::map<TIntermTyped*, TString> mFlaggedStructMappedNames;
+ std::map<TIntermTyped*, TString> mFlaggedStructOriginalNames;
+
+ void makeFlaggedStructMaps(const std::vector<TIntermTyped *> &flaggedStructs);
</ins><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorParseContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> // Look at a '.' field selector string and change it into offsets
</span><span class="cx"> // for a matrix.
</span><span class="cx"> //
</span><del>-bool TParseContext::parseMatrixFields(const TString& compString, int matSize, TMatrixFields& fields, const TSourceLoc& line)
</del><ins>+bool TParseContext::parseMatrixFields(const TString& compString, int matCols, int matRows, TMatrixFields& fields, const TSourceLoc& line)
</ins><span class="cx"> {
</span><span class="cx"> fields.wholeRow = false;
</span><span class="cx"> fields.wholeCol = false;
</span><span class="lines">@@ -151,7 +151,7 @@
</span><span class="cx"> fields.col = compString[1] - '0';
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (fields.row >= matSize || fields.col >= matSize) {
</del><ins>+ if (fields.row >= matRows || fields.col >= matCols) {
</ins><span class="cx"> error(line, "matrix field selection out of range", compString.c_str());
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -277,6 +277,7 @@
</span><span class="cx"> case EOpIndexDirect:
</span><span class="cx"> case EOpIndexIndirect:
</span><span class="cx"> case EOpIndexDirectStruct:
</span><ins>+ case EOpIndexDirectInterfaceBlock:
</ins><span class="cx"> return lValueErrorCheck(line, op, binaryNode->getLeft());
</span><span class="cx"> case EOpVectorSwizzle:
</span><span class="cx"> errorReturn = lValueErrorCheck(line, op, binaryNode->getLeft());
</span><span class="lines">@@ -317,6 +318,8 @@
</span><span class="cx"> case EvqConst: message = "can't modify a const"; break;
</span><span class="cx"> case EvqConstReadOnly: message = "can't modify a const"; break;
</span><span class="cx"> case EvqAttribute: message = "can't modify an attribute"; break;
</span><ins>+ case EvqFragmentIn: message = "can't modify an input"; break;
+ case EvqVertexIn: message = "can't modify an input"; break;
</ins><span class="cx"> case EvqUniform: message = "can't modify a uniform"; break;
</span><span class="cx"> case EvqVaryingIn: message = "can't modify a varying"; break;
</span><span class="cx"> case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
</span><span class="lines">@@ -327,17 +330,12 @@
</span><span class="cx"> //
</span><span class="cx"> // Type that can't be written to?
</span><span class="cx"> //
</span><del>- switch (node->getBasicType()) {
- case EbtSampler2D:
- case EbtSamplerCube:
- message = "can't modify a sampler";
- break;
- case EbtVoid:
</del><ins>+ if (node->getBasicType() == EbtVoid) {
</ins><span class="cx"> message = "can't modify void";
</span><del>- break;
- default:
- break;
</del><span class="cx"> }
</span><ins>+ if (IsSampler(node->getBasicType())) {
+ message = "can't modify a sampler";
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (message == 0 && binaryNode == 0 && symNode == 0) {
</span><span class="lines">@@ -396,7 +394,7 @@
</span><span class="cx"> //
</span><span class="cx"> bool TParseContext::integerErrorCheck(TIntermTyped* node, const char* token)
</span><span class="cx"> {
</span><del>- if (node->getBasicType() == EbtInt && node->getNominalSize() == 1)
</del><ins>+ if (node->isScalarInt())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> error(node->getLine(), "integer expression required", token);
</span><span class="lines">@@ -437,7 +435,7 @@
</span><span class="cx"> error(line, reservedErrMsg, "gl_");
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><del>- if (isWebGLBasedSpec(shaderSpec)) {
</del><ins>+ if (IsWebGLBasedSpec(shaderSpec)) {
</ins><span class="cx"> if (identifier.compare(0, 6, "webgl_") == 0) {
</span><span class="cx"> error(line, reservedErrMsg, "webgl_");
</span><span class="cx"> return true;
</span><span class="lines">@@ -599,7 +597,7 @@
</span><span class="cx"> //
</span><span class="cx"> bool TParseContext::boolErrorCheck(const TSourceLoc& line, const TPublicType& pType)
</span><span class="cx"> {
</span><del>- if (pType.type != EbtBool || pType.array || pType.matrix || (pType.size > 1)) {
</del><ins>+ if (pType.type != EbtBool || pType.isAggregate()) {
</ins><span class="cx"> error(line, "boolean expression expected", "");
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -628,11 +626,20 @@
</span><span class="cx">
</span><span class="cx"> bool TParseContext::structQualifierErrorCheck(const TSourceLoc& line, const TPublicType& pType)
</span><span class="cx"> {
</span><del>- if ((pType.qualifier == EvqVaryingIn || pType.qualifier == EvqVaryingOut || pType.qualifier == EvqAttribute) &&
- pType.type == EbtStruct) {
- error(line, "cannot be used with a structure", getQualifierString(pType.qualifier));
-
- return true;
</del><ins>+ switch (pType.qualifier)
+ {
+ case EvqVaryingIn:
+ case EvqVaryingOut:
+ case EvqAttribute:
+ case EvqVertexIn:
+ case EvqFragmentOut:
+ if (pType.type == EbtStruct)
+ {
+ error(line, "cannot be used with a structure", getQualifierString(pType.qualifier));
+ return true;
+ }
+
+ default: break;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (pType.qualifier != EvqUniform && samplerErrorCheck(line, pType, "samplers must be uniform"))
</span><span class="lines">@@ -641,6 +648,17 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool TParseContext::locationDeclaratorListCheck(const TSourceLoc& line, const TPublicType &pType)
+{
+ if (pType.layoutQualifier.location != -1)
+ {
+ error(line, "location must only be specified for a single input or output variable", "location");
+ return true;
+ }
+
+ return false;
+}
+
</ins><span class="cx"> bool TParseContext::parameterSamplerErrorCheck(const TSourceLoc& line, TQualifier qualifier, const TType& type)
</span><span class="cx"> {
</span><span class="cx"> if ((qualifier == EvqOut || qualifier == EvqInOut) &&
</span><span class="lines">@@ -657,7 +675,7 @@
</span><span class="cx"> if (IsSampler(type.getBasicType()))
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- if (type.getBasicType() == EbtStruct) {
</del><ins>+ if (type.getBasicType() == EbtStruct || type.isInterfaceBlock()) {
</ins><span class="cx"> const TFieldList& fields = type.getStruct()->fields();
</span><span class="cx"> for (unsigned int i = 0; i < fields.size(); ++i) {
</span><span class="cx"> if (containsSampler(*fields[i]->type()))
</span><span class="lines">@@ -676,19 +694,37 @@
</span><span class="cx"> bool TParseContext::arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* expr, int& size)
</span><span class="cx"> {
</span><span class="cx"> TIntermConstantUnion* constant = expr->getAsConstantUnion();
</span><del>- if (constant == 0 || constant->getBasicType() != EbtInt) {
</del><ins>+
+ if (constant == 0 || !constant->isScalarInt())
+ {
</ins><span class="cx"> error(line, "array size must be a constant integer expression", "");
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- size = constant->getIConst(0);
</del><ins>+ if (constant->getBasicType() == EbtUInt)
+ {
+ unsigned int uintSize = constant->getUConst(0);
+ if (uintSize > static_cast<unsigned int>(std::numeric_limits<int>::max()))
+ {
+ error(line, "array size too large", "");
+ size = 1;
+ return true;
+ }
</ins><span class="cx">
</span><del>- if (size <= 0) {
- error(line, "array size must be a positive integer", "");
- size = 1;
- return true;
</del><ins>+ size = static_cast<int>(uintSize);
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ size = constant->getIConst(0);
</ins><span class="cx">
</span><ins>+ if (size <= 0)
+ {
+ error(line, "array size must be a positive integer", "");
+ size = 1;
+ return true;
+ }
+ }
+
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -699,7 +735,7 @@
</span><span class="cx"> //
</span><span class="cx"> bool TParseContext::arrayQualifierErrorCheck(const TSourceLoc& line, TPublicType type)
</span><span class="cx"> {
</span><del>- if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqConst)) {
</del><ins>+ if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqVertexIn) || (type.qualifier == EvqConst)) {
</ins><span class="cx"> error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str());
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -733,7 +769,7 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns true if there was an error.
</span><span class="cx"> //
</span><del>-bool TParseContext::arrayErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType type, TVariable*& variable)
</del><ins>+bool TParseContext::arrayErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType &type, TVariable*& variable)
</ins><span class="cx"> {
</span><span class="cx"> //
</span><span class="cx"> // Don't check for reserved word use until after we know it's not in the symbol table,
</span><span class="lines">@@ -742,7 +778,7 @@
</span><span class="cx">
</span><span class="cx"> bool builtIn = false;
</span><span class="cx"> bool sameScope = false;
</span><del>- TSymbol* symbol = symbolTable.find(identifier, &builtIn, &sameScope);
</del><ins>+ TSymbol* symbol = symbolTable.find(identifier, 0, &builtIn, &sameScope);
</ins><span class="cx"> if (symbol == 0 || !sameScope) {
</span><span class="cx"> if (reservedErrorCheck(line, identifier))
</span><span class="cx"> return true;
</span><span class="lines">@@ -752,7 +788,7 @@
</span><span class="cx"> if (type.arraySize)
</span><span class="cx"> variable->getType().setArraySize(type.arraySize);
</span><span class="cx">
</span><del>- if (! symbolTable.insert(*variable)) {
</del><ins>+ if (! symbolTable.declare(*variable)) {
</ins><span class="cx"> delete variable;
</span><span class="cx"> error(line, "INTERNAL ERROR inserting new symbol", identifier.c_str());
</span><span class="cx"> return true;
</span><span class="lines">@@ -793,7 +829,7 @@
</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& line, TString& identifier, TPublicType& type, bool array)
</del><ins>+bool TParseContext::nonInitConstErrorCheck(const TSourceLoc& line, const TString& identifier, TPublicType& type, bool array)
</ins><span class="cx"> {
</span><span class="cx"> if (type.qualifier == EvqConst)
</span><span class="cx"> {
</span><span class="lines">@@ -825,14 +861,14 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns true if there was an error.
</span><span class="cx"> //
</span><del>-bool TParseContext::nonInitErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, TVariable*& variable)
</del><ins>+bool TParseContext::nonInitErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType& type, TVariable*& variable)
</ins><span class="cx"> {
</span><span class="cx"> if (reservedErrorCheck(line, identifier))
</span><span class="cx"> recover();
</span><span class="cx">
</span><span class="cx"> variable = new TVariable(&identifier, TType(type));
</span><span class="cx">
</span><del>- if (! symbolTable.insert(*variable)) {
</del><ins>+ if (! symbolTable.declare(*variable)) {
</ins><span class="cx"> error(line, "redefinition", variable->getName().c_str());
</span><span class="cx"> delete variable;
</span><span class="cx"> variable = 0;
</span><span class="lines">@@ -885,6 +921,45 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool TParseContext::singleDeclarationErrorCheck(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier)
+{
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ return true;
+
+ // check for layout qualifier issues
+ const TLayoutQualifier layoutQualifier = publicType.layoutQualifier;
+
+ if (layoutQualifier.matrixPacking != EmpUnspecified)
+ {
+ error(identifierLocation, "layout qualifier", getMatrixPackingString(layoutQualifier.matrixPacking), "only valid for interface blocks");
+ return true;
+ }
+
+ if (layoutQualifier.blockStorage != EbsUnspecified)
+ {
+ error(identifierLocation, "layout qualifier", getBlockStorageString(layoutQualifier.blockStorage), "only valid for interface blocks");
+ return true;
+ }
+
+ if (publicType.qualifier != EvqVertexIn && publicType.qualifier != EvqFragmentOut && layoutLocationErrorCheck(identifierLocation, publicType.layoutQualifier))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool TParseContext::layoutLocationErrorCheck(const TSourceLoc& location, const TLayoutQualifier &layoutQualifier)
+{
+ if (layoutQualifier.location != -1)
+ {
+ error(location, "invalid layout qualifier:", "location", "only valid on program inputs and outputs");
+ return true;
+ }
+
+ return false;
+}
+
</ins><span class="cx"> bool TParseContext::supportsExtension(const char* extension)
</span><span class="cx"> {
</span><span class="cx"> const TExtensionBehavior& extbehavior = extensionBehavior();
</span><span class="lines">@@ -905,6 +980,22 @@
</span><span class="cx"> return (iter->second == EBhEnable || iter->second == EBhRequire);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TParseContext::handleExtensionDirective(const TSourceLoc& loc, const char* extName, const char* behavior)
+{
+ pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ directiveHandler.handleExtension(srcLoc, extName, behavior);
+}
+
+void TParseContext::handlePragmaDirective(const TSourceLoc& loc, const char* name, const char* value)
+{
+ pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ directiveHandler.handlePragma(srcLoc, name, value);
+}
+
</ins><span class="cx"> /////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> //
</span><span class="cx"> // Non-Errors.
</span><span class="lines">@@ -916,14 +1007,14 @@
</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& line, TFunction* call, bool *builtIn)
</del><ins>+const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, int shaderVersion, 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->getName(), builtIn);
</del><ins>+ const TSymbol* symbol = symbolTable.find(call->getName(), shaderVersion, builtIn);
</ins><span class="cx"> if (symbol == 0 || symbol->isFunction()) {
</span><del>- symbol = symbolTable.find(call->getMangledName(), builtIn);
</del><ins>+ symbol = symbolTable.find(call->getMangledName(), shaderVersion, builtIn);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (symbol == 0) {
</span><span class="lines">@@ -943,7 +1034,7 @@
</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& line, TString& identifier, TPublicType& pType,
</del><ins>+bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
</ins><span class="cx"> TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable)
</span><span class="cx"> {
</span><span class="cx"> TType type = TType(pType);
</span><span class="lines">@@ -959,7 +1050,7 @@
</span><span class="cx"> // add variable to symbol table
</span><span class="cx"> //
</span><span class="cx"> variable = new TVariable(&identifier, type);
</span><del>- if (! symbolTable.insert(*variable)) {
</del><ins>+ if (! symbolTable.declare(*variable)) {
</ins><span class="cx"> error(line, "redefinition", variable->getName().c_str());
</span><span class="cx"> return true;
</span><span class="cx"> // don't delete variable, it's used by error recovery, and the pool
</span><span class="lines">@@ -997,7 +1088,7 @@
</span><span class="cx"> if (initializer->getAsConstantUnion()) {
</span><span class="cx"> variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer());
</span><span class="cx"> } else if (initializer->getAsSymbolNode()) {
</span><del>- const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol());
</del><ins>+ const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0);
</ins><span class="cx"> const TVariable* tVar = static_cast<const TVariable*>(symbol);
</span><span class="cx">
</span><span class="cx"> ConstantUnion* constArray = tVar->getConstPointer();
</span><span class="lines">@@ -1044,6 +1135,381 @@
</span><span class="cx"> return allConstant;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TPublicType TParseContext::addFullySpecifiedType(TQualifier qualifier, TLayoutQualifier layoutQualifier, const TPublicType& typeSpecifier)
+{
+ TPublicType returnType = typeSpecifier;
+ returnType.qualifier = qualifier;
+ returnType.layoutQualifier = layoutQualifier;
+
+ if (typeSpecifier.array)
+ {
+ error(typeSpecifier.line, "not supported", "first-class array");
+ recover();
+ returnType.setArray(false);
+ }
+
+ if (shaderVersion < 300)
+ {
+ if (qualifier == EvqAttribute && (typeSpecifier.type == EbtBool || typeSpecifier.type == EbtInt))
+ {
+ error(typeSpecifier.line, "cannot be bool or int", getQualifierString(qualifier));
+ recover();
+ }
+
+ if ((qualifier == EvqVaryingIn || qualifier == EvqVaryingOut) &&
+ (typeSpecifier.type == EbtBool || typeSpecifier.type == EbtInt))
+ {
+ error(typeSpecifier.line, "cannot be bool or int", getQualifierString(qualifier));
+ recover();
+ }
+ }
+ else
+ {
+ switch (qualifier)
+ {
+ case EvqSmoothIn:
+ case EvqSmoothOut:
+ case EvqVertexOut:
+ case EvqFragmentIn:
+ case EvqCentroidOut:
+ case EvqCentroidIn:
+ if (typeSpecifier.type == EbtBool)
+ {
+ error(typeSpecifier.line, "cannot be bool", getQualifierString(qualifier));
+ recover();
+ }
+ if (typeSpecifier.type == EbtInt || typeSpecifier.type == EbtUInt)
+ {
+ error(typeSpecifier.line, "must use 'flat' interpolation here", getQualifierString(qualifier));
+ recover();
+ }
+ break;
+
+ case EvqVertexIn:
+ case EvqFragmentOut:
+ case EvqFlatIn:
+ case EvqFlatOut:
+ if (typeSpecifier.type == EbtBool)
+ {
+ error(typeSpecifier.line, "cannot be bool", getQualifierString(qualifier));
+ recover();
+ }
+ break;
+
+ default: break;
+ }
+ }
+
+ return returnType;
+}
+
+TIntermAggregate* TParseContext::parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier)
+{
+ TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
+ TIntermAggregate* aggregate = intermediate.makeAggregate(symbol, identifierLocation);
+
+ if (identifier != "")
+ {
+ if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
+ recover();
+
+ // this error check can mutate the type
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, false))
+ recover();
+
+ TVariable* variable = 0;
+
+ if (nonInitErrorCheck(identifierLocation, identifier, publicType, variable))
+ recover();
+
+ if (variable && symbol)
+ {
+ symbol->setId(variable->getUniqueId());
+ }
+ }
+
+ return aggregate;
+}
+
+TIntermAggregate* TParseContext::parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression)
+{
+ if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
+ recover();
+
+ // this error check can mutate the type
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, true))
+ recover();
+
+ if (arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
+ {
+ recover();
+ }
+
+ TPublicType arrayType = publicType;
+
+ int size;
+ if (arraySizeErrorCheck(identifierLocation, indexExpression, size))
+ {
+ recover();
+ }
+ else
+ {
+ arrayType.setArray(true, size);
+ }
+
+ TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(arrayType), identifierLocation);
+ TIntermAggregate* aggregate = intermediate.makeAggregate(symbol, identifierLocation);
+ TVariable* variable = 0;
+
+ if (arrayErrorCheck(identifierLocation, identifier, arrayType, variable))
+ recover();
+
+ if (variable && symbol)
+ {
+ symbol->setId(variable->getUniqueId());
+ }
+
+ return aggregate;
+}
+
+TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer)
+{
+ if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
+ recover();
+
+ TIntermNode* intermNode;
+ if (!executeInitializer(identifierLocation, identifier, publicType, initializer, intermNode))
+ {
+ //
+ // Build intermediate representation
+ //
+ return intermNode ? intermediate.makeAggregate(intermNode, initLocation) : NULL;
+ }
+ else
+ {
+ recover();
+ return NULL;
+ }
+}
+
+TIntermAggregate* TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier)
+{
+ if (publicType.type == EbtInvariant && !identifierSymbol)
+ {
+ error(identifierLocation, "undeclared identifier declared as invariant", identifier.c_str());
+ recover();
+ }
+
+ TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
+ TIntermAggregate* intermAggregate = intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
+
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ recover();
+
+ if (locationDeclaratorListCheck(identifierLocation, publicType))
+ recover();
+
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, false))
+ recover();
+
+ TVariable* variable = 0;
+ if (nonInitErrorCheck(identifierLocation, identifier, publicType, variable))
+ recover();
+ if (symbol && variable)
+ symbol->setId(variable->getUniqueId());
+
+ return intermAggregate;
+}
+
+TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression)
+{
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ recover();
+
+ if (locationDeclaratorListCheck(identifierLocation, publicType))
+ recover();
+
+ if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, true))
+ recover();
+
+ if (arrayTypeErrorCheck(arrayLocation, publicType) || arrayQualifierErrorCheck(arrayLocation, publicType))
+ {
+ recover();
+ }
+ else if (indexExpression)
+ {
+ int size;
+ if (arraySizeErrorCheck(arrayLocation, indexExpression, size))
+ recover();
+ TPublicType arrayType(publicType);
+ arrayType.setArray(true, size);
+ TVariable* variable = NULL;
+ if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
+ recover();
+ TType type = TType(arrayType);
+ type.setArraySize(size);
+
+ return intermediate.growAggregate(declaratorList, intermediate.addSymbol(variable ? variable->getUniqueId() : 0, identifier, type, identifierLocation), identifierLocation);
+ }
+ else
+ {
+ TPublicType arrayType(publicType);
+ arrayType.setArray(true);
+ TVariable* variable = NULL;
+ if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
+ recover();
+ }
+
+ return NULL;
+}
+
+TIntermAggregate* TParseContext::parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer)
+{
+ if (structQualifierErrorCheck(identifierLocation, publicType))
+ recover();
+
+ if (locationDeclaratorListCheck(identifierLocation, publicType))
+ recover();
+
+ TIntermNode* intermNode;
+ if (!executeInitializer(identifierLocation, identifier, publicType, initializer, intermNode))
+ {
+ //
+ // build the intermediate representation
+ //
+ if (intermNode)
+ {
+ return intermediate.growAggregate(declaratorList, intermNode, initLocation);
+ }
+ else
+ {
+ return declaratorList;
+ }
+ }
+ else
+ {
+ recover();
+ return NULL;
+ }
+}
+
+void TParseContext::parseGlobalLayoutQualifier(const TPublicType &typeQualifier)
+{
+ if (typeQualifier.qualifier != EvqUniform)
+ {
+ error(typeQualifier.line, "invalid qualifier:", getQualifierString(typeQualifier.qualifier), "global layout must be uniform");
+ recover();
+ return;
+ }
+
+ const TLayoutQualifier layoutQualifier = typeQualifier.layoutQualifier;
+ ASSERT(!layoutQualifier.isEmpty());
+
+ if (shaderVersion < 300)
+ {
+ error(typeQualifier.line, "layout qualifiers supported in GLSL ES 3.00 only", "layout");
+ recover();
+ return;
+ }
+
+ if (layoutLocationErrorCheck(typeQualifier.line, typeQualifier.layoutQualifier))
+ {
+ recover();
+ return;
+ }
+
+ if (layoutQualifier.matrixPacking != EmpUnspecified)
+ {
+ defaultMatrixPacking = layoutQualifier.matrixPacking;
+ }
+
+ if (layoutQualifier.blockStorage != EbsUnspecified)
+ {
+ defaultBlockStorage = layoutQualifier.blockStorage;
+ }
+}
+
+TFunction *TParseContext::addConstructorFunc(TPublicType publicType)
+{
+ TOperator op = EOpNull;
+ if (publicType.userDef)
+ {
+ op = EOpConstructStruct;
+ }
+ else
+ {
+ switch (publicType.type)
+ {
+ case EbtFloat:
+ if (publicType.isMatrix())
+ {
+ // TODO: non-square matrices
+ switch(publicType.getCols())
+ {
+ case 2: op = EOpConstructMat2; break;
+ case 3: op = EOpConstructMat3; break;
+ case 4: op = EOpConstructMat4; break;
+ }
+ }
+ else
+ {
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructFloat; break;
+ case 2: op = EOpConstructVec2; break;
+ case 3: op = EOpConstructVec3; break;
+ case 4: op = EOpConstructVec4; break;
+ }
+ }
+ break;
+
+ case EbtInt:
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructInt; break;
+ case 2: op = EOpConstructIVec2; break;
+ case 3: op = EOpConstructIVec3; break;
+ case 4: op = EOpConstructIVec4; break;
+ }
+ break;
+
+ case EbtUInt:
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructUInt; break;
+ case 2: op = EOpConstructUVec2; break;
+ case 3: op = EOpConstructUVec3; break;
+ case 4: op = EOpConstructUVec4; break;
+ }
+ break;
+
+ case EbtBool:
+ switch(publicType.getNominalSize())
+ {
+ case 1: op = EOpConstructBool; break;
+ case 2: op = EOpConstructBVec2; break;
+ case 3: op = EOpConstructBVec3; break;
+ case 4: op = EOpConstructBVec4; break;
+ }
+ break;
+
+ default: break;
+ }
+
+ if (op == EOpNull)
+ {
+ error(publicType.line, "cannot construct this type", getBasicString(publicType.type));
+ recover();
+ publicType.type = EbtFloat;
+ op = EOpConstructFloat;
+ }
+ }
+
+ TString tempString;
+ TType type(publicType);
+ return new TFunction(&tempString, type, op);
+}
+
</ins><span class="cx"> // This function is used to test for the correctness of the parameters passed to various constructor functions
</span><span class="cx"> // and also convert them to the right datatype if it is allowed and required.
</span><span class="cx"> //
</span><span class="lines">@@ -1056,9 +1522,9 @@
</span><span class="cx">
</span><span class="cx"> TIntermAggregate* aggrNode = node->getAsAggregate();
</span><span class="cx">
</span><del>- TFieldList::const_iterator memberFields;
</del><ins>+ TFieldList::const_iterator memberTypes;
</ins><span class="cx"> if (op == EOpConstructStruct)
</span><del>- memberFields = type->getStruct()->fields().begin();
</del><ins>+ memberTypes = type->getStruct()->fields().begin();
</ins><span class="cx">
</span><span class="cx"> TType elementType = *type;
</span><span class="cx"> if (type->isArray())
</span><span class="lines">@@ -1080,7 +1546,7 @@
</span><span class="cx"> if (type->isArray())
</span><span class="cx"> newNode = constructStruct(node, &elementType, 1, node->getLine(), false);
</span><span class="cx"> else if (op == EOpConstructStruct)
</span><del>- newNode = constructStruct(node, (*memberFields)->type(), 1, node->getLine(), false);
</del><ins>+ newNode = constructStruct(node, (*memberTypes)->type(), 1, node->getLine(), false);
</ins><span class="cx"> else
</span><span class="cx"> newNode = constructBuiltIn(type, op, node, node->getLine(), false);
</span><span class="cx">
</span><span class="lines">@@ -1111,7 +1577,7 @@
</span><span class="cx"> if (type->isArray())
</span><span class="cx"> newNode = constructStruct(*p, &elementType, paramCount+1, node->getLine(), true);
</span><span class="cx"> else if (op == EOpConstructStruct)
</span><del>- newNode = constructStruct(*p, memberFields[paramCount]->type(), paramCount+1, node->getLine(), true);
</del><ins>+ newNode = constructStruct(*p, (memberTypes[paramCount])->type(), paramCount+1, node->getLine(), true);
</ins><span class="cx"> else
</span><span class="cx"> newNode = constructBuiltIn(type, op, *p, node->getLine(), true);
</span><span class="cx">
</span><span class="lines">@@ -1136,10 +1602,10 @@
</span><span class="cx"> bool returnVal = false;
</span><span class="cx"> ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
</span><span class="cx"> if (aggrNode->getSequence().size() == 1) {
</span><del>- returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), symbolTable, type, true);
</del><ins>+ returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type, true);
</ins><span class="cx"> }
</span><span class="cx"> else {
</span><del>- returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), symbolTable, type);
</del><ins>+ returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type);
</ins><span class="cx"> }
</span><span class="cx"> if (returnVal)
</span><span class="cx"> return 0;
</span><span class="lines">@@ -1183,6 +1649,13 @@
</span><span class="cx"> basicOp = EOpConstructInt;
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case EOpConstructUVec2:
+ case EOpConstructUVec3:
+ case EOpConstructUVec4:
+ case EOpConstructUInt:
+ basicOp = EOpConstructUInt;
+ break;
+
</ins><span class="cx"> case EOpConstructBVec2:
</span><span class="cx"> case EOpConstructBVec3:
</span><span class="cx"> case EOpConstructBVec4:
</span><span class="lines">@@ -1196,7 +1669,7 @@
</span><span class="cx">
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><del>- newNode = intermediate.addUnaryMath(basicOp, node, node->getLine(), symbolTable);
</del><ins>+ newNode = intermediate.addUnaryMath(basicOp, node, node->getLine());
</ins><span class="cx"> if (newNode == 0) {
</span><span class="cx"> error(line, "can't convert", "constructor");
</span><span class="cx"> return 0;
</span><span class="lines">@@ -1295,7 +1768,7 @@
</span><span class="cx"> TIntermTyped* typedNode;
</span><span class="cx"> TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
</span><span class="cx">
</span><del>- if (index >= node->getType().getNominalSize()) {
</del><ins>+ if (index >= node->getType().getCols()) {
</ins><span class="cx"> std::stringstream extraInfoStream;
</span><span class="cx"> extraInfoStream << "matrix field selection out of range '" << index << "'";
</span><span class="cx"> std::string extraInfo = extraInfoStream.str();
</span><span class="lines">@@ -1306,7 +1779,7 @@
</span><span class="cx">
</span><span class="cx"> if (tempConstantNode) {
</span><span class="cx"> ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
</span><del>- int size = tempConstantNode->getType().getNominalSize();
</del><ins>+ int size = tempConstantNode->getType().getCols();
</ins><span class="cx"> typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
</span><span class="cx"> } else {
</span><span class="cx"> error(line, "Cannot offset into the matrix", "Error");
</span><span class="lines">@@ -1342,9 +1815,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (tempConstantNode) {
</span><del>- size_t arrayElementSize = arrayElementType.getObjectSize();
- ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
- typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
</del><ins>+ size_t arrayElementSize = arrayElementType.getObjectSize();
+ ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
+ typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
</ins><span class="cx"> } else {
</span><span class="cx"> error(line, "Cannot offset into the array", "Error");
</span><span class="cx"> recover();
</span><span class="lines">@@ -1361,11 +1834,11 @@
</span><span class="cx"> // If there is an embedded/nested struct, it appropriately calls addConstStructNested or addConstStructFromAggr
</span><span class="cx"> // function and returns the parse-tree with the values of the embedded/nested struct.
</span><span class="cx"> //
</span><del>-TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* node, const TSourceLoc& line)
</del><ins>+TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line)
</ins><span class="cx"> {
</span><span class="cx"> const TFieldList& fields = node->getType().getStruct()->fields();
</span><ins>+ size_t instanceSize = 0;
</ins><span class="cx">
</span><del>- size_t instanceSize = 0;
</del><span class="cx"> for (size_t index = 0; index < fields.size(); ++index) {
</span><span class="cx"> if (fields[index]->name() == identifier) {
</span><span class="cx"> break;
</span><span class="lines">@@ -1374,8 +1847,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- TIntermTyped* typedNode = 0;
- TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
</del><ins>+ TIntermTyped *typedNode;
+ TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
</ins><span class="cx"> if (tempConstantNode) {
</span><span class="cx"> ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
</span><span class="cx">
</span><span class="lines">@@ -1390,6 +1863,146 @@
</span><span class="cx"> return typedNode;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+//
+// Interface/uniform blocks
+//
+TIntermAggregate* TParseContext::addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TFieldList* fieldList,
+ const TString* instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine)
+{
+ if (reservedErrorCheck(nameLine, blockName))
+ recover();
+
+ if (typeQualifier.qualifier != EvqUniform)
+ {
+ error(typeQualifier.line, "invalid qualifier:", getQualifierString(typeQualifier.qualifier), "interface blocks must be uniform");
+ recover();
+ }
+
+ TLayoutQualifier blockLayoutQualifier = typeQualifier.layoutQualifier;
+ if (layoutLocationErrorCheck(typeQualifier.line, blockLayoutQualifier))
+ {
+ recover();
+ }
+
+ if (blockLayoutQualifier.matrixPacking == EmpUnspecified)
+ {
+ blockLayoutQualifier.matrixPacking = defaultMatrixPacking;
+ }
+
+ if (blockLayoutQualifier.blockStorage == EbsUnspecified)
+ {
+ blockLayoutQualifier.blockStorage = defaultBlockStorage;
+ }
+
+ TSymbol* blockNameSymbol = new TInterfaceBlockName(&blockName);
+ if (!symbolTable.declare(*blockNameSymbol)) {
+ error(nameLine, "redefinition", blockName.c_str(), "interface block name");
+ recover();
+ }
+
+ // check for sampler types and apply layout qualifiers
+ for (size_t memberIndex = 0; memberIndex < fieldList->size(); ++memberIndex) {
+ TField* field = (*fieldList)[memberIndex];
+ TType* fieldType = field->type();
+ if (IsSampler(fieldType->getBasicType())) {
+ error(field->line(), "unsupported type", fieldType->getBasicString(), "sampler types are not allowed in interface blocks");
+ recover();
+ }
+
+ const TQualifier qualifier = fieldType->getQualifier();
+ switch (qualifier)
+ {
+ case EvqGlobal:
+ case EvqUniform:
+ break;
+ default:
+ error(field->line(), "invalid qualifier on interface block member", getQualifierString(qualifier));
+ recover();
+ break;
+ }
+
+ // check layout qualifiers
+ TLayoutQualifier fieldLayoutQualifier = fieldType->getLayoutQualifier();
+ if (layoutLocationErrorCheck(field->line(), fieldLayoutQualifier))
+ {
+ recover();
+ }
+
+ if (fieldLayoutQualifier.blockStorage != EbsUnspecified)
+ {
+ error(field->line(), "invalid layout qualifier:", getBlockStorageString(fieldLayoutQualifier.blockStorage), "cannot be used here");
+ recover();
+ }
+
+ if (fieldLayoutQualifier.matrixPacking == EmpUnspecified)
+ {
+ fieldLayoutQualifier.matrixPacking = blockLayoutQualifier.matrixPacking;
+ }
+ else if (!fieldType->isMatrix())
+ {
+ error(field->line(), "invalid layout qualifier:", getMatrixPackingString(fieldLayoutQualifier.matrixPacking), "can only be used on matrix types");
+ recover();
+ }
+
+ fieldType->setLayoutQualifier(fieldLayoutQualifier);
+ }
+
+ // add array index
+ int arraySize = 0;
+ if (arrayIndex != NULL)
+ {
+ if (arraySizeErrorCheck(arrayIndexLine, arrayIndex, arraySize))
+ recover();
+ }
+
+ TInterfaceBlock* interfaceBlock = new TInterfaceBlock(&blockName, fieldList, instanceName, arraySize, blockLayoutQualifier);
+ TType interfaceBlockType(interfaceBlock, typeQualifier.qualifier, blockLayoutQualifier, arraySize);
+
+ TString symbolName = "";
+ int symbolId = 0;
+
+ if (!instanceName)
+ {
+ // define symbols for the members of the interface block
+ for (size_t memberIndex = 0; memberIndex < fieldList->size(); ++memberIndex)
+ {
+ TField* field = (*fieldList)[memberIndex];
+ TType* fieldType = field->type();
+
+ // set parent pointer of the field variable
+ fieldType->setInterfaceBlock(interfaceBlock);
+
+ TVariable* fieldVariable = new TVariable(&field->name(), *fieldType);
+ fieldVariable->setQualifier(typeQualifier.qualifier);
+
+ if (!symbolTable.declare(*fieldVariable)) {
+ error(field->line(), "redefinition", field->name().c_str(), "interface block member name");
+ recover();
+ }
+ }
+ }
+ else
+ {
+ // add a symbol for this interface block
+ TVariable* instanceTypeDef = new TVariable(instanceName, interfaceBlockType, false);
+ instanceTypeDef->setQualifier(typeQualifier.qualifier);
+
+ if (!symbolTable.declare(*instanceTypeDef)) {
+ error(instanceLine, "redefinition", instanceName->c_str(), "interface block instance name");
+ recover();
+ }
+
+ symbolId = instanceTypeDef->getUniqueId();
+ symbolName = instanceTypeDef->getName();
+ }
+
+ TIntermAggregate *aggregate = intermediate.makeAggregate(intermediate.addSymbol(symbolId, symbolName, interfaceBlockType, typeQualifier.line), nameLine);
+ aggregate->setOp(EOpDeclaration);
+
+ exitStructDeclaration();
+ return aggregate;
+}
+
</ins><span class="cx"> bool TParseContext::enterStructDeclaration(const TSourceLoc& line, const TString& identifier)
</span><span class="cx"> {
</span><span class="cx"> ++structNestingLevel;
</span><span class="lines">@@ -1418,7 +2031,7 @@
</span><span class="cx">
</span><span class="cx"> bool TParseContext::structNestingErrorCheck(const TSourceLoc& line, const TField& field)
</span><span class="cx"> {
</span><del>- if (!isWebGLBasedSpec(shaderSpec)) {
</del><ins>+ if (!IsWebGLBasedSpec(shaderSpec)) {
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1531,6 +2144,17 @@
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><ins>+ if (baseExpression->isInterfaceBlock())
+ {
+ error(location, "", "[", "array indexes for interface blocks arrays must be constant integral expressions");
+ recover();
+ }
+ else if (baseExpression->getQualifier() == EvqFragmentOut)
+ {
+ error(location, "", "[", "array indexes for fragment outputs must be constant integral expressions");
+ recover();
+ }
+
</ins><span class="cx"> indexedExpression = intermediate.addIndex(EOpIndexIndirect, baseExpression, indexExpression, location);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1548,9 +2172,14 @@
</span><span class="cx"> TType copyOfType(baseType.getStruct());
</span><span class="cx"> indexedExpression->setType(copyOfType);
</span><span class="cx"> }
</span><ins>+ else if (baseType.isInterfaceBlock())
+ {
+ TType copyOfType(baseType.getInterfaceBlock(), baseType.getQualifier(), baseType.getLayoutQualifier(), 0);
+ indexedExpression->setType(copyOfType);
+ }
</ins><span class="cx"> else
</span><span class="cx"> {
</span><del>- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, baseExpression->getNominalSize(), baseExpression->isMatrix()));
</del><ins>+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, baseExpression->getNominalSize(), baseExpression->getSecondarySize()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (baseExpression->getType().getQualifier() == EvqConst)
</span><span class="lines">@@ -1561,7 +2190,7 @@
</span><span class="cx"> else if (baseExpression->isMatrix())
</span><span class="cx"> {
</span><span class="cx"> TQualifier qualifier = baseExpression->getType().getQualifier() == EvqConst ? EvqConst : EvqTemporary;
</span><del>- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), qualifier, baseExpression->getNominalSize()));
</del><ins>+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), qualifier, baseExpression->getRows()));
</ins><span class="cx"> }
</span><span class="cx"> else if (baseExpression->isVector())
</span><span class="cx"> {
</span><span class="lines">@@ -1576,6 +2205,406 @@
</span><span class="cx"> return indexedExpression;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TIntermTyped* TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc& dotLocation, const TString &fieldString, const TSourceLoc& fieldLocation)
+{
+ TIntermTyped *indexedExpression = NULL;
+
+ if (baseExpression->isArray())
+ {
+ error(fieldLocation, "cannot apply dot operator to an array", ".");
+ recover();
+ }
+
+ if (baseExpression->isVector())
+ {
+ TVectorFields fields;
+ if (!parseVectorFields(fieldString, baseExpression->getNominalSize(), fields, fieldLocation))
+ {
+ fields.num = 1;
+ fields.offsets[0] = 0;
+ recover();
+ }
+
+ if (baseExpression->getType().getQualifier() == EvqConst)
+ {
+ // constant folding for vector fields
+ indexedExpression = addConstVectorNode(fields, baseExpression, fieldLocation);
+ if (indexedExpression == 0)
+ {
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqConst, (int) (fieldString).size()));
+ }
+ }
+ else
+ {
+ TString vectorString = fieldString;
+ TIntermTyped* index = intermediate.addSwizzle(fields, fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpVectorSwizzle, baseExpression, index, dotLocation);
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, (int) vectorString.size()));
+ }
+ }
+ else if (baseExpression->isMatrix())
+ {
+ TMatrixFields fields;
+ if (!parseMatrixFields(fieldString, baseExpression->getCols(), baseExpression->getRows(), fields, fieldLocation))
+ {
+ fields.wholeRow = false;
+ fields.wholeCol = false;
+ fields.row = 0;
+ fields.col = 0;
+ recover();
+ }
+
+ if (fields.wholeRow || fields.wholeCol)
+ {
+ error(dotLocation, " non-scalar fields not implemented yet", ".");
+ recover();
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(0);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),EvqTemporary, baseExpression->getCols(), baseExpression->getRows()));
+ }
+ else
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(fields.col * baseExpression->getRows() + fields.row);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision()));
+ }
+ }
+ else if (baseExpression->getBasicType() == EbtStruct)
+ {
+ bool fieldFound = false;
+ const TFieldList& fields = baseExpression->getType().getStruct()->fields();
+ if (fields.empty())
+ {
+ error(dotLocation, "structure has no fields", "Internal Error");
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ unsigned int i;
+ for (i = 0; i < fields.size(); ++i)
+ {
+ if (fields[i]->name() == fieldString)
+ {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound)
+ {
+ if (baseExpression->getType().getQualifier() == EvqConst)
+ {
+ indexedExpression = addConstStruct(fieldString, baseExpression, dotLocation);
+ if (indexedExpression == 0)
+ {
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ indexedExpression->setType(*fields[i]->type());
+ // change the qualifier of the return type, not of the structure field
+ // as the structure definition is shared between various structures.
+ indexedExpression->getTypePointer()->setQualifier(EvqConst);
+ }
+ }
+ else
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(i);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirectStruct, baseExpression, index, dotLocation);
+ indexedExpression->setType(*fields[i]->type());
+ }
+ }
+ else
+ {
+ error(dotLocation, " no such field in structure", fieldString.c_str());
+ recover();
+ indexedExpression = baseExpression;
+ }
+ }
+ }
+ else if (baseExpression->isInterfaceBlock())
+ {
+ bool fieldFound = false;
+ const TFieldList& fields = baseExpression->getType().getInterfaceBlock()->fields();
+ if (fields.empty())
+ {
+ error(dotLocation, "interface block has no fields", "Internal Error");
+ recover();
+ indexedExpression = baseExpression;
+ }
+ else
+ {
+ unsigned int i;
+ for (i = 0; i < fields.size(); ++i)
+ {
+ if (fields[i]->name() == fieldString)
+ {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound)
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setIConst(i);
+ TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
+ indexedExpression = intermediate.addIndex(EOpIndexDirectInterfaceBlock, baseExpression, index, dotLocation);
+ indexedExpression->setType(*fields[i]->type());
+ }
+ else
+ {
+ error(dotLocation, " no such field in interface block", fieldString.c_str());
+ recover();
+ indexedExpression = baseExpression;
+ }
+ }
+ }
+ else
+ {
+ if (shaderVersion < 300)
+ {
+ error(dotLocation, " field selection requires structure, vector, or matrix on left hand side", fieldString.c_str());
+ }
+ else
+ {
+ error(dotLocation, " field selection requires structure, vector, matrix, or interface block on left hand side", fieldString.c_str());
+ }
+ recover();
+ indexedExpression = baseExpression;
+ }
+
+ return indexedExpression;
+}
+
+TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine)
+{
+ TLayoutQualifier qualifier;
+
+ qualifier.location = -1;
+ qualifier.matrixPacking = EmpUnspecified;
+ qualifier.blockStorage = EbsUnspecified;
+
+ if (qualifierType == "shared")
+ {
+ qualifier.blockStorage = EbsShared;
+ }
+ else if (qualifierType == "packed")
+ {
+ qualifier.blockStorage = EbsPacked;
+ }
+ else if (qualifierType == "std140")
+ {
+ qualifier.blockStorage = EbsStd140;
+ }
+ else if (qualifierType == "row_major")
+ {
+ qualifier.matrixPacking = EmpRowMajor;
+ }
+ else if (qualifierType == "column_major")
+ {
+ qualifier.matrixPacking = EmpColumnMajor;
+ }
+ else if (qualifierType == "location")
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str(), "location requires an argument");
+ recover();
+ }
+ else
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str());
+ recover();
+ }
+
+ return qualifier;
+}
+
+TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, const TString &intValueString, int intValue, const TSourceLoc& intValueLine)
+{
+ TLayoutQualifier qualifier;
+
+ qualifier.location = -1;
+ qualifier.matrixPacking = EmpUnspecified;
+ qualifier.blockStorage = EbsUnspecified;
+
+ if (qualifierType != "location")
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str(), "only location may have arguments");
+ recover();
+ }
+ else
+ {
+ // must check that location is non-negative
+ if (intValue < 0)
+ {
+ error(intValueLine, "out of range:", intValueString.c_str(), "location must be non-negative");
+ recover();
+ }
+ else
+ {
+ qualifier.location = intValue;
+ }
+ }
+
+ return qualifier;
+}
+
+TLayoutQualifier TParseContext::joinLayoutQualifiers(TLayoutQualifier leftQualifier, TLayoutQualifier rightQualifier)
+{
+ TLayoutQualifier joinedQualifier = leftQualifier;
+
+ if (rightQualifier.location != -1)
+ {
+ joinedQualifier.location = rightQualifier.location;
+ }
+ if (rightQualifier.matrixPacking != EmpUnspecified)
+ {
+ joinedQualifier.matrixPacking = rightQualifier.matrixPacking;
+ }
+ if (rightQualifier.blockStorage != EbsUnspecified)
+ {
+ joinedQualifier.blockStorage = rightQualifier.blockStorage;
+ }
+
+ return joinedQualifier;
+}
+
+TPublicType TParseContext::joinInterpolationQualifiers(const TSourceLoc &interpolationLoc, TQualifier interpolationQualifier,
+ const TSourceLoc &storageLoc, TQualifier storageQualifier)
+{
+ TQualifier mergedQualifier = EvqSmoothIn;
+
+ if (storageQualifier == EvqFragmentIn) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqSmoothIn;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatIn;
+ else UNREACHABLE();
+ }
+ else if (storageQualifier == EvqCentroidIn) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqCentroidIn;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatIn;
+ else UNREACHABLE();
+ }
+ else if (storageQualifier == EvqVertexOut) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqSmoothOut;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatOut;
+ else UNREACHABLE();
+ }
+ else if (storageQualifier == EvqCentroidOut) {
+ if (interpolationQualifier == EvqSmooth)
+ mergedQualifier = EvqCentroidOut;
+ else if (interpolationQualifier == EvqFlat)
+ mergedQualifier = EvqFlatOut;
+ else UNREACHABLE();
+ }
+ else {
+ error(interpolationLoc, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString(interpolationQualifier));
+ recover();
+
+ mergedQualifier = storageQualifier;
+ }
+
+ TPublicType type;
+ type.setBasic(EbtVoid, mergedQualifier, storageLoc);
+ return type;
+}
+
+TFieldList *TParseContext::addStructDeclaratorList(const TPublicType& typeSpecifier, TFieldList *fieldList)
+{
+ if (voidErrorCheck(typeSpecifier.line, (*fieldList)[0]->name(), typeSpecifier)) {
+ recover();
+ }
+
+ for (unsigned int i = 0; i < fieldList->size(); ++i) {
+ //
+ // Careful not to replace already known aspects of type, like array-ness
+ //
+ TType* type = (*fieldList)[i]->type();
+ type->setBasicType(typeSpecifier.type);
+ type->setPrimarySize(typeSpecifier.primarySize);
+ type->setSecondarySize(typeSpecifier.secondarySize);
+ type->setPrecision(typeSpecifier.precision);
+ type->setQualifier(typeSpecifier.qualifier);
+ type->setLayoutQualifier(typeSpecifier.layoutQualifier);
+
+ // don't allow arrays of arrays
+ if (type->isArray()) {
+ if (arrayTypeErrorCheck(typeSpecifier.line, typeSpecifier))
+ recover();
+ }
+ if (typeSpecifier.array)
+ type->setArraySize(typeSpecifier.arraySize);
+ if (typeSpecifier.userDef) {
+ type->setStruct(typeSpecifier.userDef->getStruct());
+ }
+
+ if (structNestingErrorCheck(typeSpecifier.line, *(*fieldList)[i])) {
+ recover();
+ }
+ }
+
+ return fieldList;
+}
+
+TPublicType TParseContext::addStructure(const TSourceLoc& structLine, const TSourceLoc& nameLine, const TString *structName, TFieldList* fieldList)
+{
+ TStructure* structure = new TStructure(structName, fieldList);
+ TType* structureType = new TType(structure);
+
+ if (!structName->empty())
+ {
+ if (reservedErrorCheck(nameLine, *structName))
+ {
+ recover();
+ }
+ TVariable* userTypeDef = new TVariable(structName, *structureType, true);
+ if (!symbolTable.declare(*userTypeDef)) {
+ error(nameLine, "redefinition", structName->c_str(), "struct");
+ recover();
+ }
+ }
+
+ // ensure we do not specify any storage qualifiers on the struct members
+ for (unsigned int typeListIndex = 0; typeListIndex < fieldList->size(); typeListIndex++)
+ {
+ const TField &field = *(*fieldList)[typeListIndex];
+ const TQualifier qualifier = field.type()->getQualifier();
+ switch (qualifier)
+ {
+ case EvqGlobal:
+ case EvqTemporary:
+ break;
+ default:
+ error(field.line(), "invalid qualifier on struct member", getQualifierString(qualifier));
+ recover();
+ break;
+ }
+ }
+
+ TPublicType publicType;
+ publicType.setBasic(EbtStruct, EvqTemporary, structLine);
+ publicType.userDef = structureType;
+ exitStructDeclaration();
+
+ return publicType;
+}
+
</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 (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -9,9 +9,9 @@
</span><span class="cx"> #include "compiler/translator/Diagnostics.h"
</span><span class="cx"> #include "compiler/translator/DirectiveHandler.h"
</span><span class="cx"> #include "compiler/translator/localintermediate.h"
</span><del>-#include "compiler/preprocessor/Preprocessor.h"
</del><span class="cx"> #include "compiler/translator/ShHandle.h"
</span><span class="cx"> #include "compiler/translator/SymbolTable.h"
</span><ins>+#include "compiler/preprocessor/Preprocessor.h"
</ins><span class="cx">
</span><span class="cx"> struct TMatrixFields {
</span><span class="cx"> bool wholeRow;
</span><span class="lines">@@ -38,14 +38,18 @@
</span><span class="cx"> currentFunctionType(NULL),
</span><span class="cx"> functionReturnsValue(false),
</span><span class="cx"> checksPrecisionErrors(checksPrecErrors),
</span><ins>+ defaultMatrixPacking(EmpColumnMajor),
+ defaultBlockStorage(EbsShared),
</ins><span class="cx"> diagnostics(is),
</span><del>- directiveHandler(ext, diagnostics),
</del><ins>+ shaderVersion(100),
+ directiveHandler(ext, diagnostics, shaderVersion),
</ins><span class="cx"> preprocessor(&diagnostics, &directiveHandler),
</span><span class="cx"> scanner(NULL) { }
</span><span class="cx"> TIntermediate& intermediate; // to hold and build a parse tree
</span><span class="cx"> TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
</span><span class="cx"> ShShaderType shaderType; // vertex or fragment language (future: pack or unpack)
</span><span class="cx"> ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
</span><ins>+ int shaderVersion;
</ins><span class="cx"> int compileOptions;
</span><span class="cx"> const char* sourcePath; // Path of source file or NULL.
</span><span class="cx"> TIntermNode* treeRoot; // root of parse tree being created
</span><span class="lines">@@ -55,12 +59,15 @@
</span><span class="cx"> bool functionReturnsValue; // true if a non-void function has a return
</span><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><ins>+ TLayoutMatrixPacking defaultMatrixPacking;
+ TLayoutBlockStorage defaultBlockStorage;
</ins><span class="cx"> TString HashErrMsg;
</span><span class="cx"> TDiagnostics diagnostics;
</span><span class="cx"> TDirectiveHandler directiveHandler;
</span><span class="cx"> pp::Preprocessor preprocessor;
</span><span class="cx"> void* scanner;
</span><span class="cx">
</span><ins>+ int getShaderVersion() const { return shaderVersion; }
</ins><span class="cx"> int numErrors() const { return diagnostics.numErrors(); }
</span><span class="cx"> TInfoSink& infoSink() { return diagnostics.infoSink(); }
</span><span class="cx"> void error(const TSourceLoc& loc, const char *reason, const char* token,
</span><span class="lines">@@ -71,7 +78,7 @@
</span><span class="cx"> void recover();
</span><span class="cx">
</span><span class="cx"> bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc& line);
</span><del>- bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, const TSourceLoc& line);
</del><ins>+ bool parseMatrixFields(const TString&, int matCols, int matRows, TMatrixFields&, const TSourceLoc& line);
</ins><span class="cx">
</span><span class="cx"> bool reservedErrorCheck(const TSourceLoc& line, const TString& identifier);
</span><span class="cx"> void assignError(const TSourceLoc& line, const char* op, TString left, TString right);
</span><span class="lines">@@ -86,29 +93,44 @@
</span><span class="cx"> bool arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* expr, int& size);
</span><span class="cx"> bool arrayQualifierErrorCheck(const TSourceLoc& line, TPublicType type);
</span><span class="cx"> bool arrayTypeErrorCheck(const TSourceLoc& line, TPublicType type);
</span><del>- bool arrayErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType type, TVariable*& variable);
</del><ins>+ bool arrayErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType &type, TVariable*& variable);
</ins><span class="cx"> bool voidErrorCheck(const TSourceLoc&, const TString&, const TPublicType&);
</span><span class="cx"> bool boolErrorCheck(const TSourceLoc&, const TIntermTyped*);
</span><span class="cx"> bool boolErrorCheck(const TSourceLoc&, const TPublicType&);
</span><span class="cx"> bool samplerErrorCheck(const TSourceLoc& line, const TPublicType& pType, const char* reason);
</span><span class="cx"> bool structQualifierErrorCheck(const TSourceLoc& line, const TPublicType& pType);
</span><ins>+ bool locationDeclaratorListCheck(const TSourceLoc& line, const TPublicType &pType);
</ins><span class="cx"> bool parameterSamplerErrorCheck(const TSourceLoc& line, TQualifier qualifier, const TType& type);
</span><del>- bool nonInitConstErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, bool array);
- bool nonInitErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, TVariable*& variable);
</del><ins>+ bool nonInitConstErrorCheck(const TSourceLoc& line, const TString& identifier, TPublicType& type, bool array);
+ bool nonInitErrorCheck(const TSourceLoc& line, const TString& identifier, const TPublicType& type, TVariable*& variable);
</ins><span class="cx"> bool paramErrorCheck(const TSourceLoc& line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
</span><span class="cx"> bool extensionErrorCheck(const TSourceLoc& line, const TString&);
</span><ins>+ bool singleDeclarationErrorCheck(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
+ bool layoutLocationErrorCheck(const TSourceLoc& location, const TLayoutQualifier &layoutQualifier);
</ins><span class="cx">
</span><span class="cx"> const TPragma& pragma() const { return directiveHandler.pragma(); }
</span><span class="cx"> const TExtensionBehavior& 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><ins>+ void handleExtensionDirective(const TSourceLoc& loc, const char* extName, const char* behavior);
+ void handlePragmaDirective(const TSourceLoc& loc, const char* name, const char* value);
</ins><span class="cx">
</span><span class="cx"> bool containsSampler(TType& type);
</span><span class="cx"> bool areAllChildConst(TIntermAggregate* aggrNode);
</span><del>- const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, bool *builtIn = 0);
- bool executeInitializer(const TSourceLoc& line, TString& identifier, TPublicType& pType,
</del><ins>+ const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, int shaderVersion, bool *builtIn = 0);
+ bool executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
</ins><span class="cx"> TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
</span><span class="cx">
</span><ins>+ TPublicType addFullySpecifiedType(TQualifier qualifier, const TPublicType& typeSpecifier);
+ TPublicType addFullySpecifiedType(TQualifier qualifier, TLayoutQualifier layoutQualifier, const TPublicType& typeSpecifier);
+ TIntermAggregate* parseSingleDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier);
+ TIntermAggregate* parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& indexLocation, TIntermTyped *indexExpression);
+ TIntermAggregate* parseSingleInitDeclaration(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
+ TIntermAggregate* parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc& identifierLocation, const TString &identifier);
+ TIntermAggregate* parseArrayDeclarator(TPublicType &publicType, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression);
+ TIntermAggregate* parseInitDeclarator(TPublicType &publicType, TIntermAggregate *declaratorList, const TSourceLoc& identifierLocation, const TString &identifier, const TSourceLoc& initLocation, TIntermTyped *initializer);
+ void parseGlobalLayoutQualifier(const TPublicType &typeQualifier);
+ TFunction *addConstructorFunc(TPublicType publicType);
</ins><span class="cx"> TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, const TSourceLoc&);
</span><span class="cx"> TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
</span><span class="cx"> TIntermTyped* constructStruct(TIntermNode*, TType*, int, const TSourceLoc&, bool subset);
</span><span class="lines">@@ -116,9 +138,22 @@
</span><span class="cx"> TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, const TSourceLoc&);
</span><span class="cx"> TIntermTyped* addConstMatrixNode(int , TIntermTyped*, const TSourceLoc&);
</span><span class="cx"> TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc& line);
</span><del>- TIntermTyped* addConstStruct(TString& , TIntermTyped*, const TSourceLoc&);
</del><ins>+ TIntermTyped* addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line);
</ins><span class="cx"> TIntermTyped* addIndexExpression(TIntermTyped *baseExpression, const TSourceLoc& location, TIntermTyped *indexExpression);
</span><ins>+ TIntermTyped* addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc& dotLocation, const TString &fieldString, const TSourceLoc& fieldLocation);
</ins><span class="cx">
</span><ins>+ TFieldList *addStructDeclaratorList(const TPublicType& typeSpecifier, TFieldList *fieldList);
+ TPublicType addStructure(const TSourceLoc& structLine, const TSourceLoc& nameLine, const TString *structName, TFieldList* fieldList);
+
+ TIntermAggregate* addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TFieldList* fieldList,
+ const TString* instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine);
+
+ TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine);
+ TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, const TString &intValueString, int intValue, const TSourceLoc& intValueLine);
+ TLayoutQualifier joinLayoutQualifiers(TLayoutQualifier leftQualifier, TLayoutQualifier rightQualifier);
+ TPublicType joinInterpolationQualifiers(const TSourceLoc &interpolationLoc, TQualifier interpolationQualifier,
+ const TSourceLoc &storageLoc, TQualifier storageQualifier);
+
</ins><span class="cx"> // Performs an error check for embedded struct declarations.
</span><span class="cx"> // Returns true if an error was raised due to the declaration of
</span><span class="cx"> // this struct.
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorQualifierAlivecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool wasFound() { return found; }
</del><ins>+        bool wasFound() { return found; }
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> bool found;
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -8,70 +8,22 @@
</span><span class="cx"> #include "compiler/translator/RemoveTree.h"
</span><span class="cx">
</span><span class="cx"> //
</span><del>-// Code to recursively delete the intermediate tree.
</del><ins>+// Code to delete the intermediate tree.
</ins><span class="cx"> //
</span><del>-
-class RemoveTree : public TIntermTraverser
</del><ins>+void RemoveAllTreeNodes(TIntermNode* root)
</ins><span class="cx"> {
</span><del>-public:
- RemoveTree() : TIntermTraverser(false, false, true)
- {
- }
</del><ins>+ std::queue<TIntermNode*> nodeQueue;
</ins><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*);
-};
</del><ins>+ nodeQueue.push(root);
</ins><span class="cx">
</span><del>-void RemoveTree::visitSymbol(TIntermSymbol* node)
-{
- delete node;
-}
</del><ins>+ while (!nodeQueue.empty())
+ {
+ TIntermNode *node = nodeQueue.front();
+ nodeQueue.pop();
</ins><span class="cx">
</span><del>-bool RemoveTree::visitBinary(Visit visit, TIntermBinary* node)
-{
- delete node;
</del><ins>+ node->enqueueChildren(&nodeQueue);
</ins><span class="cx">
</span><del>- return true;
</del><ins>+ delete node;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool RemoveTree::visitUnary(Visit visit, TIntermUnary* node)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveTree::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveTree::visitSelection(Visit visit, TIntermSelection* node)
-{
- delete node;
-
- return true;
-}
-
-void RemoveTree::visitConstantUnion(TIntermConstantUnion* node)
-{
- delete node;
-}
-
-//
-// Entry point.
-//
-void RemoveAllTreeNodes(TIntermNode* root)
-{
- RemoveTree it;
-
- root->traverse(&it);
-}
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorShHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -14,8 +14,6 @@
</span><span class="cx"> // This should not be included by driver code.
</span><span class="cx"> //
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
-
</del><span class="cx"> #include "compiler/translator/BuiltInFunctionEmulator.h"
</span><span class="cx"> #include "compiler/translator/ExtensionBehavior.h"
</span><span class="cx"> #include "compiler/translator/HashNames.h"
</span><span class="lines">@@ -24,7 +22,6 @@
</span><span class="cx"> #include "compiler/translator/VariableInfo.h"
</span><span class="cx"> #include "third_party/compiler/ArrayBoundsClamper.h"
</span><span class="cx">
</span><del>-class LongNameMap;
</del><span class="cx"> class TCompiler;
</span><span class="cx"> class TDependencyGraph;
</span><span class="cx"> class TranslatorHLSL;
</span><span class="lines">@@ -33,7 +30,7 @@
</span><span class="cx"> // Helper function to identify specs that are based on the WebGL spec,
</span><span class="cx"> // like the CSS Shaders spec.
</span><span class="cx"> //
</span><del>-bool isWebGLBasedSpec(ShShaderSpec spec);
</del><ins>+bool IsWebGLBasedSpec(ShShaderSpec spec);
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // The base class used to back handles returned to the driver.
</span><span class="lines">@@ -67,25 +64,27 @@
</span><span class="cx"> int compileOptions);
</span><span class="cx">
</span><span class="cx"> // Get results of the last compilation.
</span><ins>+ int getShaderVersion() const { return shaderVersion; }
</ins><span class="cx"> TInfoSink& getInfoSink() { return infoSink; }
</span><span class="cx"> const TVariableInfoList& getAttribs() const { return attribs; }
</span><span class="cx"> const TVariableInfoList& getUniforms() const { return uniforms; }
</span><span class="cx"> const TVariableInfoList& getVaryings() const { return varyings; }
</span><del>- int getMappedNameMaxLength() const;
</del><span class="cx">
</span><span class="cx"> ShHashFunction64 getHashFunction() const { return hashFunction; }
</span><span class="cx"> NameMap& getNameMap() { return nameMap; }
</span><span class="cx"> TSymbolTable& getSymbolTable() { return symbolTable; }
</span><ins>+ ShShaderSpec getShaderSpec() const { return shaderSpec; }
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> ShShaderType getShaderType() const { return shaderType; }
</span><del>- ShShaderSpec getShaderSpec() const { return shaderSpec; }
</del><span class="cx"> // Initialize symbol-table with built-in symbols.
</span><span class="cx"> bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
</span><span class="cx"> // Clears the results from the previous compilation.
</span><span class="cx"> void clearResults();
</span><span class="cx"> // Return true if function recursion is detected or call depth exceeded.
</span><span class="cx"> bool detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool limitCallStackDepth);
</span><ins>+ // Returns true if a program has no conflicting or missing fragment outputs
+ bool validateOutputs(TIntermNode* root);
</ins><span class="cx"> // Rewrites a shader's intermediate tree according to the CSS Shaders spec.
</span><span class="cx"> void rewriteCSSShader(TIntermNode* root);
</span><span class="cx"> // Returns true if the given shader does not exceed the minimum
</span><span class="lines">@@ -93,12 +92,10 @@
</span><span class="cx"> bool validateLimitations(TIntermNode* root);
</span><span class="cx"> // Collect info for all attribs, uniforms, varyings.
</span><span class="cx"> void collectVariables(TIntermNode* root);
</span><del>- // Map long variable names into shorter ones.
- void mapLongVariableNames(TIntermNode* root);
</del><span class="cx"> // Translate to object code.
</span><span class="cx"> virtual void translate(TIntermNode* root) = 0;
</span><span class="cx"> // Returns true if, after applying the packing rules in the GLSL 1.017 spec
</span><del>- // Appendix A, section 7, the shader does not use too many uniforms.
</del><ins>+ // Appendix A, section 7, the shader does not use too many uniforms or varyings.
</ins><span class="cx"> bool enforcePackingRestrictions();
</span><span class="cx"> // Insert statements to initialize varyings without static use in the beginning
</span><span class="cx"> // of main(). It is to work around a Mac driver where such varyings in a vertex
</span><span class="lines">@@ -117,7 +114,7 @@
</span><span class="cx"> // Returns true if the shader does not use sampler dependent values to affect control
</span><span class="cx"> // flow or in operations whose time can depend on the input values.
</span><span class="cx"> bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph& graph);
</span><del>- // Return true if the maximum expression complexity below the limit.
</del><ins>+ // Return true if the maximum expression complexity is below the limit.
</ins><span class="cx"> bool limitExpressionComplexity(TIntermNode* root);
</span><span class="cx"> // Get built-in extensions with default behavior.
</span><span class="cx"> const TExtensionBehavior& getExtensionBehavior() const;
</span><span class="lines">@@ -151,14 +148,12 @@
</span><span class="cx"> BuiltInFunctionEmulator builtInFunctionEmulator;
</span><span class="cx">
</span><span class="cx"> // Results of compilation.
</span><ins>+ int shaderVersion;
</ins><span class="cx"> TInfoSink infoSink; // Output sink.
</span><span class="cx"> TVariableInfoList attribs; // Active attributes in the compiled shader.
</span><span class="cx"> TVariableInfoList uniforms; // Active uniforms in the compiled shader.
</span><span class="cx"> TVariableInfoList varyings; // Varyings in the compiled shader.
</span><span class="cx">
</span><del>- // Cached copy of the ref-counted singleton.
- LongNameMap* longNameMap;
-
</del><span class="cx"> // name hashing.
</span><span class="cx"> ShHashFunction64 hashFunction;
</span><span class="cx"> NameMap nameMap;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorShaderLangcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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,11 +12,13 @@
</span><span class="cx"> #include "GLSLANG/ShaderLang.h"
</span><span class="cx">
</span><span class="cx"> #include "compiler/translator/InitializeDll.h"
</span><del>-#include "compiler/preprocessor/length_limits.h"
</del><ins>+#include "compiler/translator/length_limits.h"
</ins><span class="cx"> #include "compiler/translator/ShHandle.h"
</span><span class="cx"> #include "compiler/translator/TranslatorHLSL.h"
</span><span class="cx"> #include "compiler/translator/VariablePacker.h"
</span><span class="cx">
</span><ins>+static 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="lines">@@ -49,8 +51,11 @@
</span><span class="cx"> //
</span><span class="cx"> int ShInitialize()
</span><span class="cx"> {
</span><del>- static const bool kInitialized = InitProcess();
- return kInitialized ? 1 : 0;
</del><ins>+ if (!isInitialized)
+ {
+ isInitialized = InitProcess();
+ }
+ return isInitialized ? 1 : 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -59,6 +64,7 @@
</span><span class="cx"> int ShFinalize()
</span><span class="cx"> {
</span><span class="cx"> DetachProcess();
</span><ins>+ isInitialized = false;
</ins><span class="cx"> return 1;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -83,10 +89,17 @@
</span><span class="cx"> resources->ARB_texture_rectangle = 0;
</span><span class="cx"> resources->EXT_draw_buffers = 0;
</span><span class="cx"> resources->EXT_frag_depth = 0;
</span><ins>+ resources->EXT_shader_texture_lod = 0;
</ins><span class="cx">
</span><span class="cx"> // Disable highp precision in fragment shader by default.
</span><span class="cx"> resources->FragmentPrecisionHigh = 0;
</span><span class="cx">
</span><ins>+ // GLSL ES 3.0 constants.
+ resources->MaxVertexOutputVectors = 16;
+ resources->MaxFragmentInputVectors = 15;
+ resources->MinProgramTexelOffset = -8;
+ resources->MaxProgramTexelOffset = 7;
+
</ins><span class="cx"> // Disable name hashing by default.
</span><span class="cx"> resources->HashFunction = NULL;
</span><span class="cx">
</span><span class="lines">@@ -174,27 +187,27 @@
</span><span class="cx"> *params = compiler->getUniforms().size();
</span><span class="cx"> break;
</span><span class="cx"> case SH_ACTIVE_UNIFORM_MAX_LENGTH:
</span><del>- *params = 1 + MAX_SYMBOL_NAME_LEN;
</del><ins>+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
</ins><span class="cx"> break;
</span><span class="cx"> case SH_ACTIVE_ATTRIBUTES:
</span><span class="cx"> *params = compiler->getAttribs().size();
</span><span class="cx"> break;
</span><span class="cx"> case SH_ACTIVE_ATTRIBUTE_MAX_LENGTH:
</span><del>- *params = 1 + MAX_SYMBOL_NAME_LEN;
</del><ins>+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
</ins><span class="cx"> break;
</span><span class="cx"> case SH_VARYINGS:
</span><span class="cx"> *params = compiler->getVaryings().size();
</span><span class="cx"> break;
</span><span class="cx"> case SH_VARYING_MAX_LENGTH:
</span><del>- *params = 1 + MAX_SYMBOL_NAME_LEN;
</del><ins>+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
</ins><span class="cx"> break;
</span><span class="cx"> case SH_MAPPED_NAME_MAX_LENGTH:
</span><span class="cx"> // Use longer length than MAX_SHORTENED_IDENTIFIER_SIZE to
</span><span class="cx"> // handle array and struct dereferences.
</span><del>- *params = 1 + MAX_SYMBOL_NAME_LEN;
</del><ins>+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
</ins><span class="cx"> break;
</span><span class="cx"> case SH_NAME_MAX_LENGTH:
</span><del>- *params = 1 + MAX_SYMBOL_NAME_LEN;
</del><ins>+ *params = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
</ins><span class="cx"> break;
</span><span class="cx"> case SH_HASHED_NAME_MAX_LENGTH:
</span><span class="cx"> if (compiler->getHashFunction() == NULL) {
</span><span class="lines">@@ -203,12 +216,16 @@
</span><span class="cx"> // 64 bits hashing output requires 16 bytes for hex
</span><span class="cx"> // representation.
</span><span class="cx"> const char HashedNamePrefix[] = HASHED_NAME_PREFIX;
</span><ins>+ (void)HashedNamePrefix;
</ins><span class="cx"> *params = 16 + sizeof(HashedNamePrefix);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case SH_HASHED_NAMES_COUNT:
</span><span class="cx"> *params = compiler->getNameMap().size();
</span><span class="cx"> break;
</span><ins>+ case SH_SHADER_VERSION:
+ *params = compiler->getShaderVersion();
+ break;
</ins><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -306,14 +323,14 @@
</span><span class="cx"> // This size must match that queried by
</span><span class="cx"> // SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_VARYING_MAX_LENGTH
</span><span class="cx"> // in ShGetInfo, below.
</span><del>- size_t variableLength = 1 + MAX_SYMBOL_NAME_LEN;
</del><ins>+ size_t variableLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
</ins><span class="cx"> ASSERT(checkVariableMaxLengths(handle, variableLength));
</span><span class="cx"> strncpy(name, varInfo.name.c_str(), variableLength);
</span><span class="cx"> name[variableLength - 1] = 0;
</span><span class="cx"> if (mappedName) {
</span><span class="cx"> // This size must match that queried by
</span><span class="cx"> // SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
</span><del>- size_t maxMappedNameLength = 1 + MAX_SYMBOL_NAME_LEN;
</del><ins>+ size_t maxMappedNameLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec());
</ins><span class="cx"> ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
</span><span class="cx"> strncpy(mappedName, varInfo.mappedName.c_str(), maxMappedNameLength);
</span><span class="cx"> mappedName[maxMappedNameLength - 1] = 0;
</span><span class="lines">@@ -377,6 +394,18 @@
</span><span class="cx"> case SH_ACTIVE_UNIFORMS_ARRAY:
</span><span class="cx"> *params = (void*)&translator->getUniforms();
</span><span class="cx"> break;
</span><ins>+ case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY:
+ *params = (void*)&translator->getInterfaceBlocks();
+ break;
+ case SH_ACTIVE_OUTPUT_VARIABLES_ARRAY:
+ *params = (void*)&translator->getOutputVariables();
+ break;
+ case SH_ACTIVE_ATTRIBUTES_ARRAY:
+ *params = (void*)&translator->getAttributes();
+ break;
+ case SH_ACTIVE_VARYINGS_ARRAY:
+ *params = (void*)&translator->getVaryings();
+ break;
</ins><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSymbolTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -19,11 +19,15 @@
</span><span class="cx"> #include <algorithm>
</span><span class="cx"> #include <climits>
</span><span class="cx">
</span><ins>+int TSymbolTableLevel::uniqueId = 0;
+
</ins><span class="cx"> TType::TType(const TPublicType &p) :
</span><del>- type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize), structure(0)
</del><ins>+ 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)
</ins><span class="cx"> {
</span><del>- if (p.userDef)
</del><ins>+ if (p.userDef) {
</ins><span class="cx"> structure = p.userDef->getStruct();
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -37,17 +41,45 @@
</span><span class="cx"> else if (isVector())
</span><span class="cx"> mangledName += 'v';
</span><span class="cx">
</span><del>- switch (type) {
- case EbtFloat: mangledName += 'f'; break;
- case EbtInt: mangledName += 'i'; break;
- case EbtBool: mangledName += 'b'; break;
- case EbtSampler2D: mangledName += "s2"; break;
- case EbtSamplerCube: mangledName += "sC"; break;
- case EbtStruct: mangledName += structure->mangledName(); break;
- default: break;
</del><ins>+ 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 += "s2"; break;
+ case EbtSampler3D: mangledName += "s3"; break;
+ case EbtSamplerCube: mangledName += "sC"; break;
+ case EbtSampler2DArray: mangledName += "s2a"; break;
+ case EbtSamplerExternalOES: mangledName += "sext"; break;
+ case EbtSampler2DRect: mangledName += "s2r"; break;
+ case EbtISampler2D: mangledName += "is2"; break;
+ case EbtISampler3D: mangledName += "is3"; break;
+ case EbtISamplerCube: mangledName += "isC"; break;
+ case EbtISampler2DArray: mangledName += "is2a"; break;
+ case EbtUSampler2D: mangledName += "us2"; break;
+ case EbtUSampler3D: mangledName += "us3"; break;
+ case EbtUSamplerCube: mangledName += "usC"; break;
+ case EbtUSampler2DArray: mangledName += "us2a"; break;
+ case EbtSampler2DShadow: mangledName += "s2s"; break;
+ case EbtSamplerCubeShadow: mangledName += "sCs"; break;
+ case EbtSampler2DArrayShadow: mangledName += "s2as"; break;
+ case EbtStruct: mangledName += structure->mangledName(); break;
+ case EbtInterfaceBlock: mangledName += interfaceBlock->mangledName(); break;
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- mangledName += static_cast<char>('0' + getNominalSize());
</del><ins>+ if (isMatrix())
+ {
+ mangledName += static_cast<char>('0' + getCols());
+ mangledName += static_cast<char>('x');
+ mangledName += static_cast<char>('0' + getRows());
+ }
+ else
+ {
+ mangledName += static_cast<char>('0' + getNominalSize());
+ }
+
</ins><span class="cx"> if (isArray()) {
</span><span class="cx"> char buf[20];
</span><span class="cx"> snprintf(buf, sizeof(buf), "%d", arraySize);
</span><span class="lines">@@ -60,14 +92,12 @@
</span><span class="cx">
</span><span class="cx"> size_t TType::getObjectSize() const
</span><span class="cx"> {
</span><del>- size_t totalSize = 0;
</del><ins>+ size_t totalSize;
</ins><span class="cx">
</span><span class="cx"> if (getBasicType() == EbtStruct)
</span><span class="cx"> totalSize = structure->objectSize();
</span><del>- else if (matrix)
- totalSize = size * size;
</del><span class="cx"> else
</span><del>- totalSize = size;
</del><ins>+ totalSize = primarySize * secondarySize;
</ins><span class="cx">
</span><span class="cx"> if (isArray()) {
</span><span class="cx"> size_t arraySize = getArraySize();
</span><span class="lines">@@ -90,9 +120,9 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TString TStructure::buildMangledName() const
</del><ins>+TString TFieldListCollection::buildMangledName() const
</ins><span class="cx"> {
</span><del>- TString mangledName("struct-");
</del><ins>+ TString mangledName(mangledNamePrefix());
</ins><span class="cx"> mangledName += *mName;
</span><span class="cx"> for (size_t i = 0; i < mFields->size(); ++i) {
</span><span class="cx"> mangledName += '-';
</span><span class="lines">@@ -101,7 +131,7 @@
</span><span class="cx"> return mangledName;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-size_t TStructure::calculateObjectSize() const
</del><ins>+size_t TFieldListCollection::calculateObjectSize() const
</ins><span class="cx"> {
</span><span class="cx"> size_t size = 0;
</span><span class="cx"> for (size_t i = 0; i < mFields->size(); ++i) {
</span><span class="lines">@@ -124,39 +154,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><del>-// Dump functions.
-//
-
-void TVariable::dump(TInfoSink& infoSink) const
-{
- infoSink.debug << getName().c_str() << ": " << type.getQualifierString() << " " << type.getPrecisionString() << " " << type.getBasicString();
- if (type.isArray()) {
- infoSink.debug << "[0]";
- }
- infoSink.debug << "\n";
-}
-
-void TFunction::dump(TInfoSink &infoSink) const
-{
- infoSink.debug << getName().c_str() << ": " << returnType.getBasicString() << " " << getMangledName().c_str() << "\n";
-}
-
-void TSymbolTableLevel::dump(TInfoSink &infoSink) const
-{
- tLevel::const_iterator it;
- for (it = level.begin(); it != level.end(); ++it)
- (*it).second->dump(infoSink);
-}
-
-void TSymbolTable::dump(TInfoSink &infoSink) const
-{
- for (int level = currentLevel(); level >= 0; --level) {
- infoSink.debug << "LEVEL " << level << "\n";
- table[level]->dump(infoSink);
- }
-}
-
-//
</del><span class="cx"> // Functions have buried pointers to delete.
</span><span class="cx"> //
</span><span class="cx"> TFunction::~TFunction()
</span><span class="lines">@@ -202,15 +199,58 @@
</span><span class="cx"> {
</span><span class="cx"> for (tLevel::iterator it = level.begin(); it != level.end(); ++it) {
</span><span class="cx"> TSymbol* symbol = it->second;
</span><del>- if (symbol->getName() == name)
</del><ins>+ if (symbol->getName() == name) {
</ins><span class="cx"> symbol->relateToExtension(ext);
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TSymbol::TSymbol(const TSymbol& copyOf)
+{
+ name = NewPoolTString(copyOf.name->c_str());
+ uniqueId = copyOf.uniqueId;
+}
+
+TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtIn, bool *sameScope)
+{
+ int level = currentLevel();
+ TSymbol *symbol;
+
+ do
+ {
+ if (level == ESSL3_BUILTINS && shaderVersion != 300) level--;
+ if (level == ESSL1_BUILTINS && shaderVersion != 100) level--;
+
+ symbol = table[level]->find(name);
+ }
+ while (symbol == 0 && --level >= 0);
+
+ if (builtIn)
+ *builtIn = (level <= LAST_BUILTIN_LEVEL);
+ if (sameScope)
+ *sameScope = (level == currentLevel());
+
+ return symbol;
+}
+
+TSymbol *TSymbolTable::findBuiltIn(const TString &name, int shaderVersion)
+{
+ for (int level = LAST_BUILTIN_LEVEL; level >= 0; level--)
+ {
+ if (level == ESSL3_BUILTINS && shaderVersion != 300) level--;
+ if (level == ESSL1_BUILTINS && shaderVersion != 100) level--;
+
+ TSymbol *symbol = table[level]->find(name);
+
+ if (symbol)
+ return symbol;
+ }
+
+ return 0;
+}
+
</ins><span class="cx"> TSymbolTable::~TSymbolTable()
</span><span class="cx"> {
</span><del>- for (size_t i = 0; i < table.size(); ++i)
- delete table[i];
- for (size_t i = 0; i < precisionStack.size(); ++i)
- delete precisionStack[i];
</del><ins>+ while (table.size() > 0)
+ pop();
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSymbolTableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.h        2014-04-30 22:57:08 UTC (rev 168055)
</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">@@ -51,7 +51,6 @@
</span><span class="cx"> virtual bool isVariable() const { return false; }
</span><span class="cx"> void setUniqueId(int id) { uniqueId = id; }
</span><span class="cx"> int getUniqueId() const { return uniqueId; }
</span><del>- virtual void dump(TInfoSink &infoSink) const = 0;
</del><span class="cx"> void relateToExtension(const TString& ext) { extension = ext; }
</span><span class="cx"> const TString& getExtension() const { return extension; }
</span><span class="cx">
</span><span class="lines">@@ -83,8 +82,6 @@
</span><span class="cx"> bool isUserType() const { return userType; }
</span><span class="cx"> void setQualifier(TQualifier qualifier) { type.setQualifier(qualifier); }
</span><span class="cx">
</span><del>- virtual void dump(TInfoSink &infoSink) const;
-
</del><span class="cx"> ConstantUnion* getConstPointer()
</span><span class="cx"> {
</span><span class="cx"> if (!unionArray)
</span><span class="lines">@@ -120,7 +117,7 @@
</span><span class="cx"> //
</span><span class="cx"> struct TParameter {
</span><span class="cx"> TString *name;
</span><del>- TType* type;
</del><ins>+ TType *type;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -166,8 +163,6 @@
</span><span class="cx"> size_t getParamCount() const { return parameters.size(); }
</span><span class="cx"> const TParameter& getParam(size_t i) const { return parameters[i]; }
</span><span class="cx">
</span><del>- virtual void dump(TInfoSink &infoSink) const;
-
</del><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TFunction);
</span><span class="cx">
</span><span class="lines">@@ -179,7 +174,19 @@
</span><span class="cx"> bool defined;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+//
+// Interface block name sub-symbol
+//
+class TInterfaceBlockName : public TSymbol
+{
+public:
+ TInterfaceBlockName(const TString *name)
+ : TSymbol(name)
+ {}
</ins><span class="cx">
</span><ins>+ virtual ~TInterfaceBlockName() {}
+};
+
</ins><span class="cx"> class TSymbolTableLevel {
</span><span class="cx"> public:
</span><span class="cx"> typedef TMap<TString, TSymbol*> tLevel;
</span><span class="lines">@@ -192,6 +199,8 @@
</span><span class="cx">
</span><span class="cx"> bool insert(const TString &name, TSymbol &symbol)
</span><span class="cx"> {
</span><ins>+ symbol.setUniqueId(++uniqueId);
+
</ins><span class="cx"> //
</span><span class="cx"> // returning true means symbol was added to the table
</span><span class="cx"> //
</span><span class="lines">@@ -214,27 +223,26 @@
</span><span class="cx"> return (*it).second;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- const_iterator begin() const
- {
- return level.begin();
- }
-
- const_iterator end() const
- {
- return level.end();
- }
-
</del><span class="cx"> void relateToOperator(const char* name, TOperator op);
</span><span class="cx"> void relateToExtension(const char* name, const TString& ext);
</span><del>- void dump(TInfoSink &infoSink) const;
</del><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> tLevel level;
</span><ins>+ static int uniqueId; // for unique identification in code generation
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+enum ESymbolLevel
+{
+ COMMON_BUILTINS = 0,
+ ESSL1_BUILTINS = 1,
+ ESSL3_BUILTINS = 2,
+ LAST_BUILTIN_LEVEL = ESSL3_BUILTINS,
+ GLOBAL_LEVEL = 3
+};
+
</ins><span class="cx"> class TSymbolTable {
</span><span class="cx"> public:
</span><del>- TSymbolTable() : uniqueId(0)
</del><ins>+ TSymbolTable()
</ins><span class="cx"> {
</span><span class="cx"> //
</span><span class="cx"> // The symbol table cannot be used until push() is called, but
</span><span class="lines">@@ -242,6 +250,7 @@
</span><span class="cx"> // that the symbol table has not been preloaded with built-ins.
</span><span class="cx"> //
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> ~TSymbolTable();
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -249,9 +258,9 @@
</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><span class="cx"> //
</span><del>- bool isEmpty() { return table.size() == 0; }
- bool atBuiltInLevel() { return table.size() == 1; }
- bool atGlobalLevel() { return table.size() <= 2; }
</del><ins>+ bool isEmpty() { return table.empty(); }
+ bool atBuiltInLevel() { return currentLevel() <= LAST_BUILTIN_LEVEL; }
+ bool atGlobalLevel() { return currentLevel() <= 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">@@ -267,79 +276,110 @@
</span><span class="cx"> precisionStack.pop_back();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool insert(TSymbol& symbol)
</del><ins>+ bool declare(TSymbol &symbol)
</ins><span class="cx"> {
</span><del>- symbol.setUniqueId(++uniqueId);
- return table[currentLevel()]->insert(symbol);
</del><ins>+ return insert(currentLevel(), symbol);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- bool insertConstInt(const char *name, int value)
</del><ins>+ bool insert(ESymbolLevel level, TSymbol &symbol)
</ins><span class="cx"> {
</span><ins>+ return table[level]->insert(symbol);
+ }
+
+ bool insertConstInt(ESymbolLevel level, const char *name, int value)
+ {
</ins><span class="cx"> TVariable *constant = new TVariable(NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConst, 1));
</span><span class="cx"> constant->getConstPointer()->setIConst(value);
</span><del>- return insert(*constant);
</del><ins>+ return insert(level, *constant);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- bool insertBuiltIn(TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0)
</del><ins>+ 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><ins>+ if (ptype1->getBasicType() == EbtGSampler2D)
+ {
+ bool gvec4 = (rvalue->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->getBasicType() == EbtGSampler3D)
+ {
+ bool gvec4 = (rvalue->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->getBasicType() == EbtGSamplerCube)
+ {
+ bool gvec4 = (rvalue->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->getBasicType() == EbtGSampler2DArray)
+ {
+ bool gvec4 = (rvalue->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;
+ }
+
</ins><span class="cx"> TFunction *function = new TFunction(NewPoolTString(name), *rvalue);
</span><span class="cx">
</span><span class="cx"> TParameter param1 = {NULL, ptype1};
</span><span class="cx"> function->addParameter(param1);
</span><span class="cx">
</span><del>- if(ptype2)
</del><ins>+ if (ptype2)
</ins><span class="cx"> {
</span><span class="cx"> TParameter param2 = {NULL, ptype2};
</span><span class="cx"> function->addParameter(param2);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if(ptype3)
</del><ins>+ if (ptype3)
</ins><span class="cx"> {
</span><span class="cx"> TParameter param3 = {NULL, ptype3};
</span><span class="cx"> function->addParameter(param3);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return insert(*function);
- }
</del><ins>+ if (ptype4)
+ {
+ TParameter param4 = {NULL, ptype4};
+ function->addParameter(param4);
+ }
</ins><span class="cx">
</span><del>- TSymbol* find(const TString& name, bool* builtIn = 0, bool *sameScope = 0)
- {
- int level = currentLevel();
- TSymbol* symbol;
- do {
- symbol = table[level]->find(name);
- --level;
- } while (symbol == 0 && level >= 0);
- level++;
- if (builtIn)
- *builtIn = level == 0;
- if (sameScope)
- *sameScope = level == currentLevel();
- return symbol;
- }
</del><ins>+ if (ptype5)
+ {
+ TParameter param5 = {NULL, ptype5};
+ function->addParameter(param5);
+ }
</ins><span class="cx">
</span><del>- TSymbol* findBuiltIn(const TString &name)
- {
- return table[0]->find(name);
</del><ins>+ insert(level, *function);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- TSymbolTableLevel* getOuterLevel() {
- assert(table.size() >= 2);
</del><ins>+ TSymbol *find(const TString &name, int shaderVersion, bool *builtIn = NULL, bool *sameScope = NULL);
+ TSymbol *findBuiltIn(const TString &name, int shaderVersion);
+
+ TSymbolTableLevel *getOuterLevel() {
+ assert(currentLevel() >= 1);
</ins><span class="cx"> return table[currentLevel() - 1];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void relateToOperator(const char* name, TOperator op) {
- table[0]->relateToOperator(name, op);
</del><ins>+ void relateToOperator(ESymbolLevel level, const char* name, TOperator op) {
+ table[level]->relateToOperator(name, op);
</ins><span class="cx"> }
</span><del>- void relateToExtension(const char* name, const TString& ext) {
- table[0]->relateToExtension(name, ext);
</del><ins>+ void relateToExtension(ESymbolLevel level, const char* name, const TString& ext) {
+ table[level]->relateToExtension(name, ext);
</ins><span class="cx"> }
</span><span class="cx"> void dump(TInfoSink &infoSink) const;
</span><span class="cx">
</span><span class="cx"> bool setDefaultPrecision(const TPublicType& type, TPrecision prec) {
</span><span class="cx"> if (!supportsPrecision(type.type))
</span><span class="cx"> return false;
</span><del>- if (type.size != 1 || type.matrix || type.array)
</del><ins>+ if (type.isAggregate())
</ins><span class="cx"> return false; // Not allowed to set for aggregate types
</span><span class="cx"> int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
</span><span class="cx"> (*precisionStack[indexOfLastElement])[type.type] = prec; // Uses map operator [], overwrites the current value
</span><span class="lines">@@ -347,15 +387,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Searches down the precisionStack for a precision qualifier for the specified TBasicType
</span><del>- TPrecision getDefaultPrecision(TBasicType type) {
</del><ins>+ TPrecision getDefaultPrecision( TBasicType type){
+
</ins><span class="cx"> if (!supportsPrecision(type))
</span><span class="cx"> return EbpUndefined;
</span><ins>+
+ // unsigned integers use the same precision as signed
+ TBasicType baseType = (type == EbtUInt) ? EbtInt : type;
+
</ins><span class="cx"> int level = static_cast<int>(precisionStack.size()) - 1;
</span><span class="cx"> assert(level >= 0); // Just to be safe. Should not happen.
</span><span class="cx"> PrecisionStackLevel::iterator it;
</span><span class="cx"> TPrecision prec = EbpUndefined; // If we dont find anything we return this. Should we error check this?
</span><span class="cx"> while (level >= 0) {
</span><del>- it = precisionStack[level]->find(type);
</del><ins>+ it = precisionStack[level]->find(baseType);
</ins><span class="cx"> if (it != precisionStack[level]->end()) {
</span><span class="cx"> prec = (*it).second;
</span><span class="cx"> break;
</span><span class="lines">@@ -366,17 +411,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- int currentLevel() const { return static_cast<int>(table.size()) - 1; }
</del><ins>+ ESymbolLevel currentLevel() const { return static_cast<ESymbolLevel>(table.size() - 1); }
</ins><span class="cx">
</span><span class="cx"> bool supportsPrecision(TBasicType type) {
</span><span class="cx"> // Only supports precision for int, float, and sampler types.
</span><del>- return type == EbtFloat || type == EbtInt || IsSampler(type);
</del><ins>+ return type == EbtFloat || type == EbtInt || type == EbtUInt || IsSampler(type);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- int uniqueId; // for unique identification in code generation
</del><span class="cx"> std::vector<TSymbolTableLevel*> table;
</span><span class="cx"> typedef TMap<TBasicType, TPrecision> PrecisionStackLevel;
</span><del>- std::vector<PrecisionStackLevel*> precisionStack;
</del><ins>+ std::vector< PrecisionStackLevel*> precisionStack;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // _SYMBOL_TABLE_INCLUDED_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorESSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -26,7 +26,7 @@
</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());
</del><ins>+ TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
</ins><span class="cx"> root->traverse(&outputESSL);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorGLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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">@@ -31,6 +31,9 @@
</span><span class="cx"> // Write GLSL version.
</span><span class="cx"> writeVersion(getShaderType(), root, sink);
</span><span class="cx">
</span><ins>+ // Write extension behaviour as needed
+ writeExtensionBehavior();
+
</ins><span class="cx"> // Write emulated built-in functions if needed.
</span><span class="cx"> getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
</span><span class="cx"> sink, false);
</span><span class="lines">@@ -39,6 +42,23 @@
</span><span class="cx"> getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
</span><span class="cx">
</span><span class="cx"> // Write translated shader.
</span><del>- TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable());
</del><ins>+ TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
</ins><span class="cx"> root->traverse(&outputGLSL);
</span><span class="cx"> }
</span><ins>+
+void TranslatorGLSL::writeExtensionBehavior() {
+ TInfoSinkBase& sink = getInfoSink().obj;
+ const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
+ for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
+ iter != extensionBehavior.end(); ++iter) {
+ if (iter->second == EBhUndefined)
+ continue;
+
+ // For GLSL output, we don't need to emit most extensions explicitly,
+ // but some we need to translate.
+ if (iter->first == "GL_EXT_shader_texture_lod") {
+ sink << "#extension GL_ARB_shader_texture_lod : "
+ << getBehaviorString(iter->second) << "\n";
+ }
+ }
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorGLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -15,6 +15,9 @@
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual void translate(TIntermNode* root);
</span><ins>+
+private:
+ void writeExtensionBehavior();
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // COMPILER_TRANSLATORGLSL_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorHLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -20,5 +20,10 @@
</span><span class="cx"> sh::OutputHLSL outputHLSL(parseContext, getResources(), mOutputType);
</span><span class="cx">
</span><span class="cx"> outputHLSL.output();
</span><del>- mActiveUniforms = outputHLSL.getUniforms();
</del><ins>+
+ mActiveUniforms = outputHLSL.getUniforms();
+ mActiveInterfaceBlocks = outputHLSL.getInterfaceBlocks();
+ mActiveOutputVariables = outputHLSL.getOutputVariables();
+ mActiveAttributes = outputHLSL.getAttributes();
+ mActiveVaryings = outputHLSL.getVaryings();
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorHLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -8,19 +8,27 @@
</span><span class="cx"> #define COMPILER_TRANSLATORHLSL_H_
</span><span class="cx">
</span><span class="cx"> #include "compiler/translator/ShHandle.h"
</span><del>-#include "compiler/translator/Uniform.h"
</del><ins>+#include "common/shadervars.h"
</ins><span class="cx">
</span><span class="cx"> class TranslatorHLSL : public TCompiler {
</span><span class="cx"> public:
</span><span class="cx"> TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
</span><span class="cx">
</span><span class="cx"> virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
</span><del>- const sh::ActiveUniforms &getUniforms() { return mActiveUniforms; }
</del><ins>+ const std::vector<gl::Uniform> &getUniforms() { return mActiveUniforms; }
+ const std::vector<gl::InterfaceBlock> &getInterfaceBlocks() const { return mActiveInterfaceBlocks; }
+ const std::vector<gl::Attribute> &getOutputVariables() { return mActiveOutputVariables; }
+ const std::vector<gl::Attribute> &getAttributes() { return mActiveAttributes; }
+ const std::vector<gl::Varying> &getVaryings() { return mActiveVaryings; }
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual void translate(TIntermNode* root);
</span><span class="cx">
</span><del>- sh::ActiveUniforms mActiveUniforms;
</del><ins>+ std::vector<gl::Uniform> mActiveUniforms;
+ std::vector<gl::InterfaceBlock> mActiveInterfaceBlocks;
+ std::vector<gl::Attribute> mActiveOutputVariables;
+ std::vector<gl::Attribute> mActiveAttributes;
+ std::vector<gl::Varying> mActiveVaryings;
</ins><span class="cx"> ShShaderOutput mOutputType;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx"> POOL_ALLOCATOR_NEW_DELETE();
</span><del>- TField(TType* type, TString* name) : mType(type), mName(name) {}
</del><ins>+ TField(TType* type, TString* name, const TSourceLoc& 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><span class="lines">@@ -28,11 +28,13 @@
</span><span class="cx"> const TType* type() const { return mType; }
</span><span class="cx">
</span><span class="cx"> const TString& name() const { return *mName; }
</span><ins>+ const TSourceLoc& line() const { return mLine; }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TField);
</span><span class="cx"> TType* mType;
</span><span class="cx"> TString* mName;
</span><ins>+ TSourceLoc mLine;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> typedef TVector<TField*> TFieldList;
</span><span class="lines">@@ -42,17 +44,9 @@
</span><span class="cx"> return new(memory) TFieldList;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-class TStructure
</del><ins>+class TFieldListCollection
</ins><span class="cx"> {
</span><span class="cx"> public:
</span><del>- POOL_ALLOCATOR_NEW_DELETE();
- TStructure(TString* name, TFieldList* fields)
- : mName(name),
- mFields(fields),
- mObjectSize(0),
- mDeepestNesting(0) {
- }
-
</del><span class="cx"> const TString& name() const { return *mName; }
</span><span class="cx"> const TFieldList& fields() const { return *mFields; }
</span><span class="cx">
</span><span class="lines">@@ -66,6 +60,34 @@
</span><span class="cx"> mObjectSize = calculateObjectSize();
</span><span class="cx"> return mObjectSize;
</span><span class="cx"> };
</span><ins>+
+protected:
+ TFieldListCollection(const TString* name, TFieldList* fields)
+ : mName(name),
+ mFields(fields),
+ mObjectSize(0) {
+ }
+ TString buildMangledName() const;
+ size_t calculateObjectSize() const;
+ virtual TString mangledNamePrefix() const = 0;
+
+ const TString* mName;
+ TFieldList* mFields;
+
+ mutable TString mMangledName;
+ mutable size_t mObjectSize;
+};
+
+// May also represent interface blocks
+class TStructure : public TFieldListCollection
+{
+public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TStructure(const TString* name, TFieldList* fields)
+ : TFieldListCollection(name, fields),
+ mDeepestNesting(0) {
+ }
+
</ins><span class="cx"> int deepestNesting() const {
</span><span class="cx"> if (mDeepestNesting == 0)
</span><span class="cx"> mDeepestNesting = calculateDeepestNesting();
</span><span class="lines">@@ -75,18 +97,41 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TStructure);
</span><del>- TString buildMangledName() const;
- size_t calculateObjectSize() const;
</del><ins>+ virtual TString mangledNamePrefix() const { return "struct-"; }
</ins><span class="cx"> int calculateDeepestNesting() const;
</span><span class="cx">
</span><del>- TString* mName;
- TFieldList* mFields;
-
- mutable TString mMangledName;
- mutable size_t mObjectSize;
</del><span class="cx"> mutable int mDeepestNesting;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class TInterfaceBlock : public TFieldListCollection
+{
+public:
+ POOL_ALLOCATOR_NEW_DELETE();
+ TInterfaceBlock(const TString* name, TFieldList* fields, const TString* instanceName, int arraySize, const TLayoutQualifier& layoutQualifier)
+ : TFieldListCollection(name, fields),
+ mInstanceName(instanceName),
+ mArraySize(arraySize),
+ mBlockStorage(layoutQualifier.blockStorage),
+ mMatrixPacking(layoutQualifier.matrixPacking) {
+ }
+
+ const TString& instanceName() const { return *mInstanceName; }
+ bool hasInstanceName() const { return mInstanceName != NULL; }
+ bool isArray() const { return mArraySize > 0; }
+ int arraySize() const { return mArraySize; }
+ TLayoutBlockStorage blockStorage() const { return mBlockStorage; }
+ TLayoutMatrixPacking matrixPacking() const { return mMatrixPacking; }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TInterfaceBlock);
+ virtual TString mangledNamePrefix() const { return "iblock-"; }
+
+ const TString* mInstanceName; // for interface block instance names
+ int mArraySize; // 0 if not an array
+ TLayoutBlockStorage mBlockStorage;
+ TLayoutMatrixPacking mMatrixPacking;
+};
+
</ins><span class="cx"> //
</span><span class="cx"> // Base class for things that have a type.
</span><span class="cx"> //
</span><span class="lines">@@ -95,15 +140,27 @@
</span><span class="cx"> public:
</span><span class="cx"> POOL_ALLOCATOR_NEW_DELETE();
</span><span class="cx"> TType() {}
</span><del>- TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, unsigned char s = 1, bool m = false, bool a = false) :
- type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(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 &p);
</span><span class="cx"> TType(TStructure* userDef, TPrecision p = EbpUndefined) :
</span><del>- type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0), structure(userDef)
</del><ins>+ 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><ins>+ TType(TInterfaceBlock* interfaceBlockIn, TQualifier qualifierIn, TLayoutQualifier layoutQualifierIn, int arraySizeIn) :
+ type(EbtInterfaceBlock), precision(EbpUndefined), qualifier(qualifierIn), layoutQualifier(layoutQualifierIn), primarySize(1), secondarySize(1), array(arraySizeIn > 0), arraySize(arraySizeIn),
+ interfaceBlock(interfaceBlockIn), structure(0)
+ {
+ }
</ins><span class="cx">
</span><span class="cx"> TBasicType getBasicType() const { return type; }
</span><span class="cx"> void setBasicType(TBasicType t) { type = t; }
</span><span class="lines">@@ -114,81 +171,56 @@
</span><span class="cx"> TQualifier getQualifier() const { return qualifier; }
</span><span class="cx"> void setQualifier(TQualifier q) { qualifier = q; }
</span><span class="cx">
</span><del>- // One-dimensional size of single instance type
- int getNominalSize() const { return size; }
- void setNominalSize(unsigned char s) { size = s; }
</del><ins>+ TLayoutQualifier getLayoutQualifier() const { return layoutQualifier; }
+ void setLayoutQualifier(TLayoutQualifier lq) { layoutQualifier = lq; }
+
+ 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"> // Full size of single instance of type
</span><span class="cx"> size_t getObjectSize() const;
</span><span class="cx">
</span><del>- int elementRegisterCount() const
- {
- if (structure)
- {
- const TFieldList &fields = getStruct()->fields();
- int registerCount = 0;
-
- for (size_t i = 0; i < fields.size(); i++)
- {
- registerCount += fields[i]->type()->totalRegisterCount();
- }
-
- return registerCount;
- }
- else if (isMatrix())
- {
- return getNominalSize();
- }
- else
- {
- return 1;
- }
- }
-
- int totalRegisterCount() const
- {
- if (array)
- {
- return arraySize * elementRegisterCount();
- }
- else
- {
- return elementRegisterCount();
- }
- }
-
- bool isMatrix() const { return matrix ? true : false; }
- void setMatrix(bool m) { matrix = m; }
-
</del><ins>+ bool isMatrix() const { return primarySize > 1 && secondarySize > 1; }
</ins><span class="cx"> bool isArray() const { return array ? true : false; }
</span><span class="cx"> int getArraySize() const { return arraySize; }
</span><span class="cx"> void setArraySize(int s) { array = true; arraySize = s; }
</span><span class="cx"> void clearArrayness() { array = false; arraySize = 0; }
</span><span class="cx">
</span><del>- bool isVector() const { return size > 1 && !matrix; }
- bool isScalar() const { return size == 1 && !matrix && !structure; }
</del><ins>+ TInterfaceBlock* getInterfaceBlock() const { return interfaceBlock; }
+ void setInterfaceBlock(TInterfaceBlock* interfaceBlockIn) { interfaceBlock = interfaceBlockIn; }
+ bool isInterfaceBlock() const { return type == EbtInterfaceBlock; }
</ins><span class="cx">
</span><ins>+ bool isVector() const { return primarySize > 1 && secondarySize == 1; }
+ bool isScalar() const { return primarySize == 1 && secondarySize == 1 && !structure; }
+ bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); }
+
</ins><span class="cx"> TStructure* getStruct() const { return structure; }
</span><span class="cx"> void setStruct(TStructure* s) { structure = s; }
</span><span class="cx">
</span><del>- const TString& getMangledName() const {
</del><ins>+ const TString& getMangledName() {
</ins><span class="cx"> if (mangled.empty()) {
</span><span class="cx"> mangled = buildMangledName();
</span><span class="cx"> mangled += ';';
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> return mangled;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool sameElementType(const TType& right) const {
</span><del>- return type == right.type &&
- size == right.size &&
- matrix == right.matrix &&
</del><ins>+ return type == right.type &&
+ primarySize == right.primarySize &&
+ secondarySize == right.secondarySize &&
</ins><span class="cx"> structure == right.structure;
</span><span class="cx"> }
</span><span class="cx"> bool operator==(const TType& right) const {
</span><del>- return type == right.type &&
- size == right.size &&
- matrix == right.matrix &&
- array == right.array && (!array || arraySize == right.arraySize) &&
</del><ins>+ return type == right.type &&
+ primarySize == right.primarySize &&
+ secondarySize == right.secondarySize &&
+ array == right.array && (!array || arraySize == right.arraySize) &&
</ins><span class="cx"> structure == right.structure;
</span><span class="cx"> // don't check the qualifier, it's not ever what's being sought after
</span><span class="cx"> }
</span><span class="lines">@@ -197,8 +229,8 @@
</span><span class="cx"> }
</span><span class="cx"> bool operator<(const TType& right) const {
</span><span class="cx"> if (type != right.type) return type < right.type;
</span><del>- if (size != right.size) return size < right.size;
- if (matrix != right.matrix) return matrix < right.matrix;
</del><ins>+ if (primarySize != right.primarySize) return primarySize < right.primarySize;
+ if (secondarySize != right.secondarySize) return secondarySize < right.secondarySize;
</ins><span class="cx"> if (array != right.array) return array < right.array;
</span><span class="cx"> if (arraySize != right.arraySize) return arraySize < right.arraySize;
</span><span class="cx"> if (structure != right.structure) return structure < right.structure;
</span><span class="lines">@@ -231,19 +263,26 @@
</span><span class="cx"> return structure ? structure->containsArrays() : false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-private:
</del><ins>+protected:
</ins><span class="cx"> TString buildMangledName() const;
</span><ins>+ size_t getStructSize() const;
+ void computeDeepestStructNesting();
</ins><span class="cx">
</span><span class="cx"> TBasicType type;
</span><span class="cx"> TPrecision precision;
</span><span class="cx"> TQualifier qualifier;
</span><del>- unsigned char size;
- bool matrix;
</del><ins>+ TLayoutQualifier layoutQualifier;
+ unsigned char primarySize; // size of vector or cols matrix
+ unsigned char secondarySize; // rows of a matrix
</ins><span class="cx"> bool array;
</span><span class="cx"> int arraySize;
</span><span class="cx">
</span><del>- TStructure* structure; // 0 unless this is a struct
</del><ins>+ // 0 unless this is an interface block, or interface block member variable
+ TInterfaceBlock* interfaceBlock;
</ins><span class="cx">
</span><ins>+ // 0 unless this is a struct
+ TStructure* structure;
+
</ins><span class="cx"> mutable TString mangled;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -259,10 +298,11 @@
</span><span class="cx"> struct TPublicType
</span><span class="cx"> {
</span><span class="cx"> TBasicType type;
</span><ins>+ TLayoutQualifier layoutQualifier;
</ins><span class="cx"> TQualifier qualifier;
</span><span class="cx"> TPrecision precision;
</span><del>- unsigned char size; // size of vector or matrix, not size of array
- bool matrix;
</del><ins>+ unsigned char primarySize; // size of vector or cols of matrix
+ unsigned char secondarySize; // rows of matrix
</ins><span class="cx"> bool array;
</span><span class="cx"> int arraySize;
</span><span class="cx"> TType* userDef;
</span><span class="lines">@@ -271,22 +311,29 @@
</span><span class="cx"> void setBasic(TBasicType bt, TQualifier q, const TSourceLoc& ln)
</span><span class="cx"> {
</span><span class="cx"> type = bt;
</span><ins>+ layoutQualifier = TLayoutQualifier::create();
</ins><span class="cx"> qualifier = q;
</span><span class="cx"> precision = EbpUndefined;
</span><del>- size = 1;
- matrix = false;
</del><ins>+ primarySize = 1;
+ secondarySize = 1;
</ins><span class="cx"> array = false;
</span><span class="cx"> arraySize = 0;
</span><span class="cx"> userDef = 0;
</span><span class="cx"> line = ln;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void setAggregate(unsigned char s, bool m = false)
</del><ins>+ void setAggregate(unsigned char size)
</ins><span class="cx"> {
</span><del>- size = s;
- matrix = m;
</del><ins>+ primarySize = size;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ void setMatrix(unsigned char c, unsigned char r)
+ {
+ ASSERT(c > 1 && r > 1 && c <= 4 && r <= 4);
+ primarySize = c;
+ secondarySize = r;
+ }
+
</ins><span class="cx"> void setArray(bool a, int s = 0)
</span><span class="cx"> {
</span><span class="cx"> array = a;
</span><span class="lines">@@ -302,6 +349,38 @@
</span><span class="cx">
</span><span class="cx"> return userDef->isStructureContainingArrays();
</span><span class="cx"> }
</span><ins>+
+ bool isMatrix() const
+ {
+ return primarySize > 1 && secondarySize > 1;
+ }
+
+ bool isVector() const
+ {
+ return primarySize > 1 && secondarySize == 1;
+ }
+
+ int getCols() const
+ {
+ ASSERT(isMatrix());
+ return primarySize;
+ }
+
+ int getRows() const
+ {
+ ASSERT(isMatrix());
+ return secondarySize;
+ }
+
+ int getNominalSize() const
+ {
+ return primarySize;
+ }
+
+ bool isAggregate() const
+ {
+ return array || isMatrix() || isVector();
+ }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #endif // _TYPES_INCLUDED_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitASTcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> // In AST traversing, a parent is visited before its children.
</span><span class="cx"> // After we replace a node, if an immediate child is to
</span><span class="cx"> // be replaced, we need to make sure we don't update the replaced
</span><del>- // node; instead, we update the replacement node.
</del><ins>+        // node; instead, we update the replacement node.
</ins><span class="cx"> for (size_t jj = ii + 1; jj < replacements.size(); ++jj)
</span><span class="cx"> {
</span><span class="cx"> NodeUpdateEntry& entry2 = replacements[jj];
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateLimitationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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,26 +9,9 @@
</span><span class="cx"> #include "compiler/translator/InitializeParseContext.h"
</span><span class="cx"> #include "compiler/translator/ParseContext.h"
</span><span class="cx">
</span><del>-namespace {
-bool IsLoopIndex(const TIntermSymbol* symbol, const TLoopStack& stack) {
- for (TLoopStack::const_iterator i = stack.begin(); i != stack.end(); ++i) {
- if (i->index.id == symbol->getId())
- return true;
- }
- return false;
-}
</del><ins>+namespace
+{
</ins><span class="cx">
</span><del>-void MarkLoopForUnroll(const TIntermSymbol* symbol, TLoopStack& stack) {
- for (TLoopStack::iterator i = stack.begin(); i != stack.end(); ++i) {
- if (i->index.id == symbol->getId()) {
- ASSERT(i->loop != NULL);
- i->loop->setUnrollFlag(true);
- return;
- }
- }
- UNREACHABLE();
-}
-
</del><span class="cx"> // Traverses a node to check if it represents a constant index expression.
</span><span class="cx"> // Definition:
</span><span class="cx"> // constant-index-expressions are a superset of constant-expressions.
</span><span class="lines">@@ -38,110 +21,60 @@
</span><span class="cx"> // - Constant expressions
</span><span class="cx"> // - Loop indices as defined in section 4
</span><span class="cx"> // - Expressions composed of both of the above
</span><del>-class ValidateConstIndexExpr : public TIntermTraverser {
-public:
- ValidateConstIndexExpr(const TLoopStack& stack)
</del><ins>+class ValidateConstIndexExpr : public TIntermTraverser
+{
+ public:
+ ValidateConstIndexExpr(TLoopStack& stack)
</ins><span class="cx"> : mValid(true), mLoopStack(stack) {}
</span><span class="cx">
</span><span class="cx"> // Returns true if the parsed node represents a constant index expression.
</span><span class="cx"> bool isValid() const { return mValid; }
</span><span class="cx">
</span><del>- virtual void visitSymbol(TIntermSymbol* symbol) {
</del><ins>+ virtual void visitSymbol(TIntermSymbol *symbol)
+ {
</ins><span class="cx"> // Only constants and loop indices are allowed in a
</span><span class="cx"> // constant index expression.
</span><del>- if (mValid) {
</del><ins>+ if (mValid)
+ {
</ins><span class="cx"> mValid = (symbol->getQualifier() == EvqConst) ||
</span><del>- IsLoopIndex(symbol, mLoopStack);
</del><ins>+ (mLoopStack.findLoop(symbol));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-private:
</del><ins>+ private:
</ins><span class="cx"> bool mValid;
</span><del>- const TLoopStack& mLoopStack;
-};
-
-// Traverses a node to check if it uses a loop index.
-// If an int loop index is used in its body as a sampler array index,
-// mark the loop for unroll.
-class ValidateLoopIndexExpr : public TIntermTraverser {
-public:
- ValidateLoopIndexExpr(TLoopStack& stack)
- : mUsesFloatLoopIndex(false),
- mUsesIntLoopIndex(false),
- mLoopStack(stack) {}
-
- bool usesFloatLoopIndex() const { return mUsesFloatLoopIndex; }
- bool usesIntLoopIndex() const { return mUsesIntLoopIndex; }
-
- virtual void visitSymbol(TIntermSymbol* symbol) {
- if (IsLoopIndex(symbol, mLoopStack)) {
- switch (symbol->getBasicType()) {
- case EbtFloat:
- mUsesFloatLoopIndex = true;
- break;
- case EbtInt:
- mUsesIntLoopIndex = true;
- MarkLoopForUnroll(symbol, mLoopStack);
- break;
- default:
- UNREACHABLE();
- }
- }
- }
-
-private:
- bool mUsesFloatLoopIndex;
- bool mUsesIntLoopIndex;
</del><span class="cx"> TLoopStack& mLoopStack;
</span><span class="cx"> };
</span><del>-} // namespace
</del><span class="cx">
</span><ins>+} // namespace anonymous
+
</ins><span class="cx"> ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
</span><del>- TInfoSinkBase& sink)
</del><ins>+ TInfoSinkBase &sink)
</ins><span class="cx"> : mShaderType(shaderType),
</span><span class="cx"> mSink(sink),
</span><span class="cx"> mNumErrors(0)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node)
</del><ins>+bool ValidateLimitations::visitBinary(Visit, TIntermBinary *node)
</ins><span class="cx"> {
</span><span class="cx"> // Check if loop index is modified in the loop body.
</span><span class="cx"> validateOperation(node, node->getLeft());
</span><span class="cx">
</span><span class="cx"> // Check indexing.
</span><del>- switch (node->getOp()) {
</del><ins>+ switch (node->getOp())
+ {
</ins><span class="cx"> case EOpIndexDirect:
</span><del>- validateIndexing(node);
- break;
</del><span class="cx"> case EOpIndexIndirect:
</span><del>-#if defined(__APPLE__)
- // Loop unrolling is a work-around for a Mac Cg compiler bug where it
- // crashes when a sampler array's index is also the loop index.
- // Once Apple fixes this bug, we should remove the code in this CL.
- // See http://codereview.appspot.com/4331048/.
- if ((node->getLeft() != NULL) && (node->getRight() != NULL) &&
- (node->getLeft()->getAsSymbolNode())) {
- TIntermSymbol* symbol = node->getLeft()->getAsSymbolNode();
- if (IsSampler(symbol->getBasicType()) && symbol->isArray()) {
- ValidateLoopIndexExpr validate(mLoopStack);
- node->getRight()->traverse(&validate);
- if (validate.usesFloatLoopIndex()) {
- error(node->getLine(),
- "sampler array index is float loop index",
- "for");
- }
- }
- }
-#endif
</del><span class="cx"> validateIndexing(node);
</span><span class="cx"> break;
</span><del>- default: break;
</del><ins>+ default:
+ break;
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::visitUnary(Visit, TIntermUnary* node)
</del><ins>+bool ValidateLimitations::visitUnary(Visit, TIntermUnary *node)
</ins><span class="cx"> {
</span><span class="cx"> // Check if loop index is modified in the loop body.
</span><span class="cx"> validateOperation(node, node->getOperand());
</span><span class="lines">@@ -149,7 +82,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate* node)
</del><ins>+bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate *node)
</ins><span class="cx"> {
</span><span class="cx"> switch (node->getOp()) {
</span><span class="cx"> case EOpFunctionCall:
</span><span class="lines">@@ -161,22 +94,20 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::visitLoop(Visit, TIntermLoop* node)
</del><ins>+bool ValidateLimitations::visitLoop(Visit, TIntermLoop *node)
</ins><span class="cx"> {
</span><span class="cx"> if (!validateLoopType(node))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- TLoopInfo info;
- memset(&info, 0, sizeof(TLoopInfo));
- info.loop = node;
- if (!validateForLoopHeader(node, &info))
</del><ins>+ if (!validateForLoopHeader(node))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- TIntermNode* body = node->getBody();
- if (body != NULL) {
- mLoopStack.push_back(info);
</del><ins>+ TIntermNode *body = node->getBody();
+ if (body != NULL)
+ {
+ mLoopStack.push(node);
</ins><span class="cx"> body->traverse(this);
</span><del>- mLoopStack.pop_back();
</del><ins>+ mLoopStack.pop();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // The loop is fully processed - no need to visit children.
</span><span class="lines">@@ -184,7 +115,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ValidateLimitations::error(TSourceLoc loc,
</span><del>- const char *reason, const char* token)
</del><ins>+ const char *reason, const char *token)
</ins><span class="cx"> {
</span><span class="cx"> mSink.prefix(EPrefixError);
</span><span class="cx"> mSink.location(loc);
</span><span class="lines">@@ -197,12 +128,13 @@
</span><span class="cx"> return !mLoopStack.empty();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::isLoopIndex(const TIntermSymbol* symbol) const
</del><ins>+bool ValidateLimitations::isLoopIndex(TIntermSymbol *symbol)
</ins><span class="cx"> {
</span><del>- return IsLoopIndex(symbol, mLoopStack);
</del><ins>+ return mLoopStack.findLoop(symbol) != NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateLoopType(TIntermLoop* node) {
</del><ins>+bool ValidateLimitations::validateLoopType(TIntermLoop *node)
+{
</ins><span class="cx"> TLoopType type = node->getType();
</span><span class="cx"> if (type == ELoopFor)
</span><span class="cx"> return true;
</span><span class="lines">@@ -214,8 +146,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateForLoopHeader(TIntermLoop* node,
- TLoopInfo* info)
</del><ins>+bool ValidateLimitations::validateForLoopHeader(TIntermLoop *node)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(node->getType() == ELoopFor);
</span><span class="cx">
</span><span class="lines">@@ -223,74 +154,80 @@
</span><span class="cx"> // The for statement has the form:
</span><span class="cx"> // for ( init-declaration ; condition ; expression ) statement
</span><span class="cx"> //
</span><del>- if (!validateForLoopInit(node, info))
</del><ins>+ int indexSymbolId = validateForLoopInit(node);
+ if (indexSymbolId < 0)
</ins><span class="cx"> return false;
</span><del>- if (!validateForLoopCond(node, info))
</del><ins>+ if (!validateForLoopCond(node, indexSymbolId))
</ins><span class="cx"> return false;
</span><del>- if (!validateForLoopExpr(node, info))
</del><ins>+ if (!validateForLoopExpr(node, indexSymbolId))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateForLoopInit(TIntermLoop* node,
- TLoopInfo* info)
</del><ins>+int ValidateLimitations::validateForLoopInit(TIntermLoop *node)
</ins><span class="cx"> {
</span><del>- TIntermNode* init = node->getInit();
- if (init == NULL) {
</del><ins>+ TIntermNode *init = node->getInit();
+ if (init == NULL)
+ {
</ins><span class="cx"> error(node->getLine(), "Missing init declaration", "for");
</span><del>- return false;
</del><ins>+ return -1;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // init-declaration has the form:
</span><span class="cx"> // type-specifier identifier = constant-expression
</span><span class="cx"> //
</span><del>- TIntermAggregate* decl = init->getAsAggregate();
- if ((decl == NULL) || (decl->getOp() != EOpDeclaration)) {
</del><ins>+ TIntermAggregate *decl = init->getAsAggregate();
+ if ((decl == NULL) || (decl->getOp() != EOpDeclaration))
+ {
</ins><span class="cx"> error(init->getLine(), "Invalid init declaration", "for");
</span><del>- return false;
</del><ins>+ return -1;
</ins><span class="cx"> }
</span><span class="cx"> // To keep things simple do not allow declaration list.
</span><del>- TIntermSequence& declSeq = decl->getSequence();
- if (declSeq.size() != 1) {
</del><ins>+ TIntermSequence &declSeq = decl->getSequence();
+ if (declSeq.size() != 1)
+ {
</ins><span class="cx"> error(decl->getLine(), "Invalid init declaration", "for");
</span><del>- return false;
</del><ins>+ return -1;
</ins><span class="cx"> }
</span><del>- TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
- if ((declInit == NULL) || (declInit->getOp() != EOpInitialize)) {
</del><ins>+ TIntermBinary *declInit = declSeq[0]->getAsBinaryNode();
+ if ((declInit == NULL) || (declInit->getOp() != EOpInitialize))
+ {
</ins><span class="cx"> error(decl->getLine(), "Invalid init declaration", "for");
</span><del>- return false;
</del><ins>+ return -1;
</ins><span class="cx"> }
</span><del>- TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
- if (symbol == NULL) {
</del><ins>+ TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
+ if (symbol == NULL)
+ {
</ins><span class="cx"> error(declInit->getLine(), "Invalid init declaration", "for");
</span><del>- return false;
</del><ins>+ return -1;
</ins><span class="cx"> }
</span><span class="cx"> // The loop index has type int or float.
</span><span class="cx"> TBasicType type = symbol->getBasicType();
</span><del>- if ((type != EbtInt) && (type != EbtFloat)) {
</del><ins>+ if ((type != EbtInt) && (type != EbtUInt) && (type != EbtFloat)) {
</ins><span class="cx"> error(symbol->getLine(),
</span><span class="cx"> "Invalid type for loop index", getBasicString(type));
</span><del>- return false;
</del><ins>+ return -1;
</ins><span class="cx"> }
</span><span class="cx"> // The loop index is initialized with constant expression.
</span><del>- if (!isConstExpr(declInit->getRight())) {
</del><ins>+ if (!isConstExpr(declInit->getRight()))
+ {
</ins><span class="cx"> error(declInit->getLine(),
</span><span class="cx"> "Loop index cannot be initialized with non-constant expression",
</span><span class="cx"> symbol->getSymbol().c_str());
</span><del>- return false;
</del><ins>+ return -1;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- info->index.id = symbol->getId();
- return true;
</del><ins>+ return symbol->getId();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateForLoopCond(TIntermLoop* node,
- TLoopInfo* info)
</del><ins>+bool ValidateLimitations::validateForLoopCond(TIntermLoop *node,
+ int indexSymbolId)
</ins><span class="cx"> {
</span><del>- TIntermNode* cond = node->getCondition();
- if (cond == NULL) {
</del><ins>+ TIntermNode *cond = node->getCondition();
+ if (cond == NULL)
+ {
</ins><span class="cx"> error(node->getLine(), "Missing condition", "for");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -298,24 +235,28 @@
</span><span class="cx"> // condition has the form:
</span><span class="cx"> // loop_index relational_operator constant_expression
</span><span class="cx"> //
</span><del>- TIntermBinary* binOp = cond->getAsBinaryNode();
- if (binOp == NULL) {
</del><ins>+ TIntermBinary *binOp = cond->getAsBinaryNode();
+ if (binOp == NULL)
+ {
</ins><span class="cx"> error(node->getLine(), "Invalid condition", "for");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> // Loop index should be to the left of relational operator.
</span><del>- TIntermSymbol* symbol = binOp->getLeft()->getAsSymbolNode();
- if (symbol == NULL) {
</del><ins>+ TIntermSymbol *symbol = binOp->getLeft()->getAsSymbolNode();
+ if (symbol == NULL)
+ {
</ins><span class="cx"> error(binOp->getLine(), "Invalid condition", "for");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- if (symbol->getId() != info->index.id) {
</del><ins>+ if (symbol->getId() != indexSymbolId)
+ {
</ins><span class="cx"> error(symbol->getLine(),
</span><span class="cx"> "Expected loop index", symbol->getSymbol().c_str());
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> // Relational operator is one of: > >= < <= == or !=.
</span><del>- switch (binOp->getOp()) {
</del><ins>+ switch (binOp->getOp())
+ {
</ins><span class="cx"> case EOpEqual:
</span><span class="cx"> case EOpNotEqual:
</span><span class="cx"> case EOpLessThan:
</span><span class="lines">@@ -330,7 +271,8 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> // Loop index must be compared with a constant.
</span><del>- if (!isConstExpr(binOp->getRight())) {
</del><ins>+ if (!isConstExpr(binOp->getRight()))
+ {
</ins><span class="cx"> error(binOp->getLine(),
</span><span class="cx"> "Loop index cannot be compared with non-constant expression",
</span><span class="cx"> symbol->getSymbol().c_str());
</span><span class="lines">@@ -340,11 +282,12 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateForLoopExpr(TIntermLoop* node,
- TLoopInfo* info)
</del><ins>+bool ValidateLimitations::validateForLoopExpr(TIntermLoop *node,
+ int indexSymbolId)
</ins><span class="cx"> {
</span><del>- TIntermNode* expr = node->getExpression();
- if (expr == NULL) {
</del><ins>+ TIntermNode *expr = node->getExpression();
+ if (expr == NULL)
+ {
</ins><span class="cx"> error(node->getLine(), "Missing expression", "for");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -358,50 +301,58 @@
</span><span class="cx"> // --loop_index
</span><span class="cx"> // The last two forms are not specified in the spec, but I am assuming
</span><span class="cx"> // its an oversight.
</span><del>- TIntermUnary* unOp = expr->getAsUnaryNode();
- TIntermBinary* binOp = unOp ? NULL : expr->getAsBinaryNode();
</del><ins>+ TIntermUnary *unOp = expr->getAsUnaryNode();
+ TIntermBinary *binOp = unOp ? NULL : expr->getAsBinaryNode();
</ins><span class="cx">
</span><span class="cx"> TOperator op = EOpNull;
</span><del>- TIntermSymbol* symbol = NULL;
- if (unOp != NULL) {
</del><ins>+ TIntermSymbol *symbol = NULL;
+ if (unOp != NULL)
+ {
</ins><span class="cx"> op = unOp->getOp();
</span><span class="cx"> symbol = unOp->getOperand()->getAsSymbolNode();
</span><del>- } else if (binOp != NULL) {
</del><ins>+ }
+ else if (binOp != NULL)
+ {
</ins><span class="cx"> op = binOp->getOp();
</span><span class="cx"> symbol = binOp->getLeft()->getAsSymbolNode();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // The operand must be loop index.
</span><del>- if (symbol == NULL) {
</del><ins>+ if (symbol == NULL)
+ {
</ins><span class="cx"> error(expr->getLine(), "Invalid expression", "for");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- if (symbol->getId() != info->index.id) {
</del><ins>+ if (symbol->getId() != indexSymbolId)
+ {
</ins><span class="cx"> error(symbol->getLine(),
</span><span class="cx"> "Expected loop index", symbol->getSymbol().c_str());
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // The operator is one of: ++ -- += -=.
</span><del>- switch (op) {
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
- break;
- case EOpAddAssign:
- case EOpSubAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
- break;
- default:
- error(expr->getLine(), "Invalid operator", getOperatorString(op));
- return false;
</del><ins>+ switch (op)
+ {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ ASSERT((unOp != NULL) && (binOp == NULL));
+ break;
+ case EOpAddAssign:
+ case EOpSubAssign:
+ ASSERT((unOp == NULL) && (binOp != NULL));
+ break;
+ default:
+ error(expr->getLine(), "Invalid operator", getOperatorString(op));
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Loop index must be incremented/decremented with a constant.
</span><del>- if (binOp != NULL) {
- if (!isConstExpr(binOp->getRight())) {
</del><ins>+ if (binOp != NULL)
+ {
+ if (!isConstExpr(binOp->getRight()))
+ {
</ins><span class="cx"> error(binOp->getLine(),
</span><span class="cx"> "Loop index cannot be modified by non-constant expression",
</span><span class="cx"> symbol->getSymbol().c_str());
</span><span class="lines">@@ -412,7 +363,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
</del><ins>+bool ValidateLimitations::validateFunctionCall(TIntermAggregate *node)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(node->getOp() == EOpFunctionCall);
</span><span class="cx">
</span><span class="lines">@@ -424,8 +375,9 @@
</span><span class="cx"> typedef std::vector<size_t> ParamIndex;
</span><span class="cx"> ParamIndex pIndex;
</span><span class="cx"> TIntermSequence& params = node->getSequence();
</span><del>- for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
- TIntermSymbol* symbol = params[i]->getAsSymbolNode();
</del><ins>+ for (TIntermSequence::size_type i = 0; i < params.size(); ++i)
+ {
+ TIntermSymbol *symbol = params[i]->getAsSymbolNode();
</ins><span class="cx"> if (symbol && isLoopIndex(symbol))
</span><span class="cx"> pIndex.push_back(i);
</span><span class="cx"> }
</span><span class="lines">@@ -436,14 +388,16 @@
</span><span class="cx">
</span><span class="cx"> bool valid = true;
</span><span class="cx"> TSymbolTable& symbolTable = GetGlobalParseContext()->symbolTable;
</span><del>- TSymbol* symbol = symbolTable.find(node->getName());
</del><ins>+ TSymbol* symbol = symbolTable.find(node->getName(), GetGlobalParseContext()->shaderVersion);
</ins><span class="cx"> ASSERT(symbol && symbol->isFunction());
</span><del>- TFunction* function = static_cast<TFunction*>(symbol);
</del><ins>+ TFunction *function = static_cast<TFunction *>(symbol);
</ins><span class="cx"> for (ParamIndex::const_iterator i = pIndex.begin();
</span><del>- i != pIndex.end(); ++i) {
- const TParameter& param = function->getParam(*i);
</del><ins>+ i != pIndex.end(); ++i)
+ {
+ const TParameter &param = function->getParam(*i);
</ins><span class="cx"> TQualifier qual = param.type->getQualifier();
</span><del>- if ((qual == EvqOut) || (qual == EvqInOut)) {
</del><ins>+ if ((qual == EvqOut) || (qual == EvqInOut))
+ {
</ins><span class="cx"> error(params[*i]->getLine(),
</span><span class="cx"> "Loop index cannot be used as argument to a function out or inout parameter",
</span><span class="cx"> params[*i]->getAsSymbolNode()->getSymbol().c_str());
</span><span class="lines">@@ -454,14 +408,16 @@
</span><span class="cx"> return valid;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateOperation(TIntermOperator* node,
- TIntermNode* operand) {
</del><ins>+bool ValidateLimitations::validateOperation(TIntermOperator *node,
+ TIntermNode* operand)
+{
</ins><span class="cx"> // Check if loop index is modified in the loop body.
</span><span class="cx"> if (!withinLoopBody() || !node->isAssignment())
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- const TIntermSymbol* symbol = operand->getAsSymbolNode();
- if (symbol && isLoopIndex(symbol)) {
</del><ins>+ TIntermSymbol *symbol = operand->getAsSymbolNode();
+ if (symbol && isLoopIndex(symbol))
+ {
</ins><span class="cx"> error(node->getLine(),
</span><span class="cx"> "Loop index cannot be statically assigned to within the body of the loop",
</span><span class="cx"> symbol->getSymbol().c_str());
</span><span class="lines">@@ -469,13 +425,13 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::isConstExpr(TIntermNode* node)
</del><ins>+bool ValidateLimitations::isConstExpr(TIntermNode *node)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(node != NULL);
</span><span class="cx"> return node->getAsConstantUnion() != NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::isConstIndexExpr(TIntermNode* node)
</del><ins>+bool ValidateLimitations::isConstIndexExpr(TIntermNode *node)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(node != NULL);
</span><span class="cx">
</span><span class="lines">@@ -484,15 +440,15 @@
</span><span class="cx"> return validate.isValid();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ValidateLimitations::validateIndexing(TIntermBinary* node)
</del><ins>+bool ValidateLimitations::validateIndexing(TIntermBinary *node)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT((node->getOp() == EOpIndexDirect) ||
</span><span class="cx"> (node->getOp() == EOpIndexIndirect));
</span><span class="cx">
</span><span class="cx"> bool valid = true;
</span><del>- TIntermTyped* index = node->getRight();
</del><ins>+ TIntermTyped *index = node->getRight();
</ins><span class="cx"> // The index expression must have integral type.
</span><del>- if (!index->isScalar() || (index->getBasicType() != EbtInt)) {
</del><ins>+ if (!index->isScalarInt()) {
</ins><span class="cx"> error(index->getLine(),
</span><span class="cx"> "Index expression must have integral type",
</span><span class="cx"> index->getCompleteString().c_str());
</span><span class="lines">@@ -500,10 +456,11 @@
</span><span class="cx"> }
</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><del>- TIntermTyped* operand = node->getLeft();
</del><ins>+ TIntermTyped *operand = node->getLeft();
</ins><span class="cx"> bool skip = (mShaderType == SH_VERTEX_SHADER) &&
</span><span class="cx"> (operand->getQualifier() == EvqUniform);
</span><del>- if (!skip && !isConstIndexExpr(index)) {
</del><ins>+ if (!skip && !isConstIndexExpr(index))
+ {
</ins><span class="cx"> error(index->getLine(), "Index expression must be constant", "[]");
</span><span class="cx"> valid = false;
</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 (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -4,55 +4,51 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
</del><span class="cx"> #include "compiler/translator/intermediate.h"
</span><ins>+#include "compiler/translator/LoopInfo.h"
</ins><span class="cx">
</span><span class="cx"> class TInfoSinkBase;
</span><span class="cx">
</span><del>-struct TLoopInfo {
- struct TIndex {
- int id; // symbol id.
- } index;
- TIntermLoop* loop;
-};
-typedef TVector<TLoopInfo> TLoopStack;
-
</del><span class="cx"> // Traverses intermediate tree to ensure that the shader does not exceed the
</span><span class="cx"> // minimum functionality mandated in GLSL 1.0 spec, Appendix A.
</span><del>-class ValidateLimitations : public TIntermTraverser {
-public:
- ValidateLimitations(ShShaderType shaderType, TInfoSinkBase& sink);
</del><ins>+class ValidateLimitations : public TIntermTraverser
+{
+ public:
+ ValidateLimitations(ShShaderType shaderType, TInfoSinkBase &sink);
</ins><span class="cx">
</span><span class="cx"> int numErrors() const { return mNumErrors; }
</span><span class="cx">
</span><del>- virtual bool visitBinary(Visit, TIntermBinary*);
- virtual bool visitUnary(Visit, TIntermUnary*);
- virtual bool visitAggregate(Visit, TIntermAggregate*);
- virtual bool visitLoop(Visit, TIntermLoop*);
</del><ins>+ virtual bool visitBinary(Visit, TIntermBinary *);
+ virtual bool visitUnary(Visit, TIntermUnary *);
+ virtual bool visitAggregate(Visit, TIntermAggregate *);
+ virtual bool visitLoop(Visit, TIntermLoop *);
</ins><span class="cx">
</span><del>-private:
- void error(TSourceLoc loc, const char *reason, const char* token);
</del><ins>+ private:
+ void error(TSourceLoc loc, const char *reason, const char *token);
</ins><span class="cx">
</span><span class="cx"> bool withinLoopBody() const;
</span><del>- bool isLoopIndex(const TIntermSymbol* symbol) const;
- bool validateLoopType(TIntermLoop* node);
- bool validateForLoopHeader(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopInit(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopCond(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopExpr(TIntermLoop* node, TLoopInfo* info);
</del><ins>+ bool isLoopIndex(TIntermSymbol *symbol);
+ bool validateLoopType(TIntermLoop *node);
+
+ bool validateForLoopHeader(TIntermLoop *node);
+ // If valid, return the index symbol id; Otherwise, return -1.
+ int validateForLoopInit(TIntermLoop *node);
+ bool validateForLoopCond(TIntermLoop *node, int indexSymbolId);
+ bool validateForLoopExpr(TIntermLoop *node, int indexSymbolId);
+
</ins><span class="cx"> // Returns true if none of the loop indices is used as the argument to
</span><span class="cx"> // the given function out or inout parameter.
</span><del>- bool validateFunctionCall(TIntermAggregate* node);
- bool validateOperation(TIntermOperator* node, TIntermNode* operand);
</del><ins>+ bool validateFunctionCall(TIntermAggregate *node);
+ bool validateOperation(TIntermOperator *node, TIntermNode *operand);
</ins><span class="cx">
</span><span class="cx"> // Returns true if indexing does not exceed the minimum functionality
</span><span class="cx"> // mandated in GLSL 1.0 spec, Appendix A, Section 5.
</span><del>- bool isConstExpr(TIntermNode* node);
- bool isConstIndexExpr(TIntermNode* node);
- bool validateIndexing(TIntermBinary* node);
</del><ins>+ bool isConstExpr(TIntermNode *node);
+ bool isConstIndexExpr(TIntermNode *node);
+ bool validateIndexing(TIntermBinary *node);
</ins><span class="cx">
</span><span class="cx"> ShShaderType mShaderType;
</span><del>- TInfoSinkBase& mSink;
</del><ins>+ TInfoSinkBase &mSink;
</ins><span class="cx"> int mNumErrors;
</span><span class="cx"> TLoopStack mLoopStack;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateOutputscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,78 @@
</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 "compiler/translator/ValidateOutputs.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/InitializeParseContext.h"
+#include "compiler/translator/ParseContext.h"
+
+ValidateOutputs::ValidateOutputs(TInfoSinkBase& sink, int maxDrawBuffers)
+ : mSink(sink),
+ mMaxDrawBuffers(maxDrawBuffers),
+ mNumErrors(0),
+ mHasUnspecifiedOutputLocation(false)
+{
+}
+
+void ValidateOutputs::visitSymbol(TIntermSymbol *symbol)
+{
+ TString name = symbol->getSymbol();
+ TQualifier qualifier = symbol->getQualifier();
+
+ if (mVisitedSymbols.count(name) == 1)
+ return;
+
+ mVisitedSymbols.insert(name);
+
+ if (qualifier == EvqFragmentOut)
+ {
+ const TType &type = symbol->getType();
+ const int location = type.getLayoutQualifier().location;
+
+ if (mHasUnspecifiedOutputLocation)
+ {
+ error(symbol->getLine(), "must explicitly specify all locations when using multiple fragment outputs", name.c_str());
+ }
+ else if (location == -1)
+ {
+ mHasUnspecifiedOutputLocation = true;
+ }
+ else
+ {
+ OutputMap::iterator mapEntry = mOutputMap.find(location);
+ if (mapEntry == mOutputMap.end())
+ {
+ const int elementCount = type.isArray() ? type.getArraySize() : 1;
+ if (location + elementCount > mMaxDrawBuffers)
+ {
+ error(symbol->getLine(), "output location must be < MAX_DRAW_BUFFERS", name.c_str());
+ }
+
+ for (int elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ const int offsetLocation = location + elementIndex;
+ mOutputMap[offsetLocation] = symbol;
+ }
+ }
+ else
+ {
+ std::stringstream strstr;
+ strstr << "conflicting output locations with previously defined output '"
+ << mapEntry->second->getSymbol() << "'";
+
+ error(symbol->getLine(), strstr.str().c_str(), name.c_str());
+ }
+ }
+ }
+}
+
+void ValidateOutputs::error(TSourceLoc loc, const char *reason, const char* token)
+{
+ mSink.prefix(EPrefixError);
+ mSink.location(loc);
+ mSink << "'" << token << "' : " << reason << "\n";
+ mNumErrors++;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateOutputsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,33 @@
</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 "compiler/translator/intermediate.h"
+
+#include <set>
+
+class TInfoSinkBase;
+
+class ValidateOutputs : public TIntermTraverser
+{
+ public:
+ ValidateOutputs(TInfoSinkBase& sink, int maxDrawBuffers);
+
+ int numErrors() const { return mNumErrors; }
+
+ virtual void visitSymbol(TIntermSymbol*);
+
+ private:
+ TInfoSinkBase& mSink;
+ int mMaxDrawBuffers;
+ int mNumErrors;
+ bool mHasUnspecifiedOutputLocation;
+
+ typedef std::map<int, TIntermSymbol*> OutputMap;
+ OutputMap mOutputMap;
+ std::set<TString> mVisitedSymbols;
+
+ void error(TSourceLoc loc, const char *reason, const char* token);
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVariableInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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">@@ -21,11 +21,32 @@
</span><span class="cx"> switch (type.getBasicType()) {
</span><span class="cx"> case EbtFloat:
</span><span class="cx"> if (type.isMatrix()) {
</span><del>- switch (type.getNominalSize()) {
- case 2: return SH_FLOAT_MAT2;
- case 3: return SH_FLOAT_MAT3;
- case 4: return SH_FLOAT_MAT4;
- default: UNREACHABLE();
</del><ins>+ 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();
+ }
</ins><span class="cx"> }
</span><span class="cx"> } else if (type.isVector()) {
</span><span class="cx"> switch (type.getNominalSize()) {
</span><span class="lines">@@ -50,6 +71,19 @@
</span><span class="cx"> } else {
</span><span class="cx"> return SH_INT;
</span><span class="cx"> }
</span><ins>+ 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;
+ }
</ins><span class="cx"> case EbtBool:
</span><span class="cx"> if (type.isMatrix()) {
</span><span class="cx"> UNREACHABLE();
</span><span class="lines">@@ -64,9 +98,22 @@
</span><span class="cx"> return SH_BOOL;
</span><span class="cx"> }
</span><span class="cx"> case EbtSampler2D: return SH_SAMPLER_2D;
</span><ins>+ case EbtSampler3D: return SH_SAMPLER_3D;
</ins><span class="cx"> case EbtSamplerCube: return SH_SAMPLER_CUBE;
</span><span class="cx"> case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES;
</span><span class="cx"> case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB;
</span><ins>+ 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;
</ins><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> return SH_NONE;
</span><span class="lines">@@ -134,7 +181,7 @@
</span><span class="cx"> TVariableInfoList& infoList,
</span><span class="cx"> ShHashFunction64 hashFunction)
</span><span class="cx"> {
</span><del>- ASSERT(type.getBasicType() == EbtStruct);
</del><ins>+ ASSERT(type.getBasicType() == EbtStruct || type.isInterfaceBlock());
</ins><span class="cx">
</span><span class="cx"> const TFieldList& fields = type.getStruct()->fields();
</span><span class="cx"> for (size_t i = 0; i < fields.size(); ++i) {
</span><span class="lines">@@ -227,7 +274,7 @@
</span><span class="cx"> info.size = 1;
</span><span class="cx"> info.precision = EbpMedium; // Use mediump as it doesn't really matter.
</span><span class="cx"> info.staticUse = true;
</span><del>- mVaryings.push_back(info);
</del><ins>+         mVaryings.push_back(info);
</ins><span class="cx"> mFragCoordAdded = true;
</span><span class="cx"> }
</span><span class="cx"> return;
</span><span class="lines">@@ -240,7 +287,7 @@
</span><span class="cx"> info.size = 1;
</span><span class="cx"> info.precision = EbpUndefined;
</span><span class="cx"> info.staticUse = true;
</span><del>- mVaryings.push_back(info);
</del><ins>+         mVaryings.push_back(info);
</ins><span class="cx"> mFrontFacingAdded = true;
</span><span class="cx"> }
</span><span class="cx"> return;
</span><span class="lines">@@ -253,7 +300,7 @@
</span><span class="cx"> info.size = 1;
</span><span class="cx"> info.precision = EbpMedium; // Use mediump as it doesn't really matter.
</span><span class="cx"> info.staticUse = true;
</span><del>- mVaryings.push_back(info);
</del><ins>+         mVaryings.push_back(info);
</ins><span class="cx"> mPointCoordAdded = true;
</span><span class="cx"> }
</span><span class="cx"> return;
</span><span class="lines">@@ -273,12 +320,26 @@
</span><span class="cx"> case EOpDeclaration: {
</span><span class="cx"> const TIntermSequence& sequence = node->getSequence();
</span><span class="cx"> TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier();
</span><del>- if (qualifier == EvqAttribute || qualifier == EvqUniform ||
</del><ins>+ if (qualifier == EvqAttribute || qualifier == EvqVertexIn || qualifier == EvqUniform ||
</ins><span class="cx"> qualifier == EvqVaryingIn || qualifier == EvqVaryingOut ||
</span><span class="cx"> qualifier == EvqInvariantVaryingIn || qualifier == EvqInvariantVaryingOut)
</span><span class="cx"> {
</span><del>- TVariableInfoList& infoList = qualifier == EvqAttribute ? mAttribs :
- (qualifier == EvqUniform ? mUniforms : mVaryings);
</del><ins>+ TVariableInfoList *infoList = NULL;
+
+ switch (qualifier)
+ {
+ case EvqAttribute:
+ case EvqVertexIn:
+ infoList = &mAttribs;
+ break;
+ case EvqUniform:
+ infoList = &mUniforms;
+ break;
+ default:
+ infoList = &mVaryings;
+ break;
+ }
+
</ins><span class="cx"> for (TIntermSequence::const_iterator i = sequence.begin();
</span><span class="cx"> i != sequence.end(); ++i)
</span><span class="cx"> {
</span><span class="lines">@@ -293,11 +354,11 @@
</span><span class="cx"> if (mHashFunction == NULL)
</span><span class="cx"> processedSymbol = variable->getSymbol();
</span><span class="cx"> else
</span><del>- processedSymbol = TIntermTraverser::hash(variable->getOriginalSymbol(), mHashFunction);
</del><ins>+ processedSymbol = TIntermTraverser::hash(variable->getSymbol(), mHashFunction);
</ins><span class="cx"> getVariableInfo(variable->getType(),
</span><del>- variable->getOriginalSymbol(),
</del><ins>+ variable->getSymbol(),
</ins><span class="cx"> processedSymbol,
</span><del>- infoList,
</del><ins>+ *infoList,
</ins><span class="cx"> mHashFunction);
</span><span class="cx"> visitChildren = false;
</span><span class="cx"> }
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVariableInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,7 +7,6 @@
</span><span class="cx"> #ifndef COMPILER_VARIABLE_INFO_H_
</span><span class="cx"> #define COMPILER_VARIABLE_INFO_H_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
</del><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx">
</span><span class="cx"> // Provides information about a variable.
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVariablePackercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,6 +13,10 @@
</span><span class="cx"> {
</span><span class="cx"> switch (type) {
</span><span class="cx"> case SH_FLOAT_MAT4:
</span><ins>+ case SH_FLOAT_MAT2x4:
+ case SH_FLOAT_MAT3x4:
+ case SH_FLOAT_MAT4x2:
+ case SH_FLOAT_MAT4x3:
</ins><span class="cx"> return 0;
</span><span class="cx"> case SH_FLOAT_MAT2:
</span><span class="cx"> return 1;
</span><span class="lines">@@ -21,6 +25,8 @@
</span><span class="cx"> case SH_BOOL_VEC4:
</span><span class="cx"> return 2;
</span><span class="cx"> case SH_FLOAT_MAT3:
</span><ins>+ case SH_FLOAT_MAT2x3:
+ case SH_FLOAT_MAT3x2:
</ins><span class="cx"> return 3;
</span><span class="cx"> case SH_FLOAT_VEC3:
</span><span class="cx"> case SH_INT_VEC3:
</span><span class="lines">@@ -50,11 +56,17 @@
</span><span class="cx"> switch (type) {
</span><span class="cx"> case SH_FLOAT_MAT4:
</span><span class="cx"> case SH_FLOAT_MAT2:
</span><ins>+ case SH_FLOAT_MAT2x4:
+ case SH_FLOAT_MAT3x4:
+ case SH_FLOAT_MAT4x2:
+ case SH_FLOAT_MAT4x3:
</ins><span class="cx"> case SH_FLOAT_VEC4:
</span><span class="cx"> case SH_INT_VEC4:
</span><span class="cx"> case SH_BOOL_VEC4:
</span><span class="cx"> return 4;
</span><span class="cx"> case SH_FLOAT_MAT3:
</span><ins>+ case SH_FLOAT_MAT2x3:
+ case SH_FLOAT_MAT3x2:
</ins><span class="cx"> case SH_FLOAT_VEC3:
</span><span class="cx"> case SH_INT_VEC3:
</span><span class="cx"> case SH_BOOL_VEC3:
</span><span class="lines">@@ -81,8 +93,14 @@
</span><span class="cx"> {
</span><span class="cx"> switch (type) {
</span><span class="cx"> case SH_FLOAT_MAT4:
</span><ins>+ case SH_FLOAT_MAT2x4:
+ case SH_FLOAT_MAT3x4:
+ case SH_FLOAT_MAT4x3:
+ case SH_FLOAT_MAT4x2:
</ins><span class="cx"> return 4;
</span><span class="cx"> case SH_FLOAT_MAT3:
</span><ins>+ case SH_FLOAT_MAT2x3:
+ case SH_FLOAT_MAT3x2:
</ins><span class="cx"> return 3;
</span><span class="cx"> case SH_FLOAT_MAT2:
</span><span class="cx"> return 2;
</span><span class="lines">@@ -197,6 +215,14 @@
</span><span class="cx"> bottomNonFullRow_ = maxRows_ - 1;
</span><span class="cx"> TVariableInfoList variables(in_variables);
</span><span class="cx">
</span><ins>+ // Check whether each variable fits in the available vectors.
+ for (size_t i = 0; i < variables.size(); i++) {
+ const TVariableInfo& variable = variables[i];
+ if (variable.size > maxVectors / GetNumRows(variable.type)) {
+ return false;
+ }
+ }
+
</ins><span class="cx"> // As per GLSL 1.017 Appendix A, Section 7 variables are packed in specific
</span><span class="cx"> // order by type, then by size of array, largest first.
</span><span class="cx"> std::sort(variables.begin(), variables.end(), TVariableInfoComparer());
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVersionGLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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,7 +7,6 @@
</span><span class="cx"> #ifndef COMPILER_VERSIONGLSL_H_
</span><span class="cx"> #define COMPILER_VERSIONGLSL_H_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
</del><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx">
</span><span class="cx"> // Traverses the intermediate tree to return the minimum GLSL version
</span><span class="lines">@@ -24,6 +23,7 @@
</span><span class="cx"> // - matrix constructors taking matrix as argument.
</span><span class="cx"> // - array as "out" function parameters
</span><span class="cx"> //
</span><ins>+// TODO: ES3 equivalent versions of GLSL
</ins><span class="cx"> class TVersionGLSL : public TIntermTraverser {
</span><span class="cx"> public:
</span><span class="cx"> TVersionGLSL(ShShaderType type);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorgenerate_parsersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/generate_parser.sh (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/generate_parser.sh        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/generate_parser.sh        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -25,3 +25,4 @@
</span><span class="cx"> # Generate Parser
</span><span class="cx"> run_flex glslang
</span><span class="cx"> run_bison glslang
</span><ins>+patch --silent --forward < 64bit-lexer-safety.patch
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslangl"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -15,7 +15,7 @@
</span><span class="cx">
</span><span class="cx"> %top{
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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">@@ -33,6 +33,11 @@
</span><span class="cx"> #pragma warning(disable: 4505)
</span><span class="cx"> #pragma warning(disable: 4701)
</span><span class="cx"> #endif
</span><ins>+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wdeprecated-register"
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> %{
</span><span class="lines">@@ -40,7 +45,8 @@
</span><span class="cx"> #include "compiler/translator/ParseContext.h"
</span><span class="cx"> #include "compiler/preprocessor/Token.h"
</span><span class="cx"> #include "compiler/translator/util.h"
</span><del>-#include "compiler/translator/glslang_tab.h"
</del><ins>+#include "compiler/translator/length_limits.h"
+#include "glslang_tab.h"
</ins><span class="cx">
</span><span class="cx"> /* windows only pragma */
</span><span class="cx"> #ifdef _MSC_VER
</span><span class="lines">@@ -57,8 +63,13 @@
</span><span class="cx"> static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
</span><span class="cx"> static int check_type(yyscan_t yyscanner);
</span><span class="cx"> static int reserved_word(yyscan_t yyscanner);
</span><ins>+static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
+static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
+static int ES2_ident_ES3_keyword(TParseContext *context, int token);
+static int uint_constant(TParseContext *context);
</ins><span class="cx"> static int int_constant(yyscan_t yyscanner);
</span><span class="cx"> static int float_constant(yyscan_t yyscanner);
</span><ins>+static int floatsuffix_check(TParseContext* context);
</ins><span class="cx"> %}
</span><span class="cx">
</span><span class="cx"> %option noyywrap nounput never-interactive
</span><span class="lines">@@ -73,16 +84,20 @@
</span><span class="cx">
</span><span class="cx"> %%
</span><span class="cx">
</span><ins>+%{
+ TParseContext* context = yyextra;
+%}
+
</ins><span class="cx"> "invariant" { return INVARIANT; }
</span><span class="cx"> "highp" { return HIGH_PRECISION; }
</span><span class="cx"> "mediump" { return MEDIUM_PRECISION; }
</span><span class="cx"> "lowp" { return LOW_PRECISION; }
</span><span class="cx"> "precision" { return PRECISION; }
</span><span class="cx">
</span><del>-"attribute" { return ATTRIBUTE; }
</del><ins>+"attribute" { return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
</ins><span class="cx"> "const" { return CONST_QUAL; }
</span><span class="cx"> "uniform" { return UNIFORM; }
</span><del>-"varying" { return VARYING; }
</del><ins>+"varying" { return ES2_keyword_ES3_reserved(context, VARYING); }
</ins><span class="cx">
</span><span class="cx"> "break" { return BREAK; }
</span><span class="cx"> "continue" { return CONTINUE; }
</span><span class="lines">@@ -92,13 +107,21 @@
</span><span class="cx">
</span><span class="cx"> "if" { return IF; }
</span><span class="cx"> "else" { return ELSE; }
</span><ins>+"switch" { return ES2_reserved_ES3_keyword(context, SWITCH); }
+"case" { return ES2_ident_ES3_keyword(context, CASE); }
+"default" { return ES2_reserved_ES3_keyword(context, DEFAULT); }
</ins><span class="cx">
</span><ins>+"centroid" { return ES2_ident_ES3_keyword(context, CENTROID); }
+"flat" { return ES2_reserved_ES3_keyword(context, FLAT); }
+"smooth" { return ES2_ident_ES3_keyword(context, SMOOTH); }
+
</ins><span class="cx"> "in" { return IN_QUAL; }
</span><span class="cx"> "out" { return OUT_QUAL; }
</span><span class="cx"> "inout" { return INOUT_QUAL; }
</span><span class="cx">
</span><span class="cx"> "float" { return FLOAT_TYPE; }
</span><span class="cx"> "int" { return INT_TYPE; }
</span><ins>+"uint" { return ES2_ident_ES3_keyword(context, UINT_TYPE); }
</ins><span class="cx"> "void" { return VOID_TYPE; }
</span><span class="cx"> "bool" { return BOOL_TYPE; }
</span><span class="cx"> "true" { yylval->lex.b = true; return BOOLCONSTANT; }
</span><span class="lines">@@ -111,6 +134,17 @@
</span><span class="cx"> "mat3" { return MATRIX3; }
</span><span class="cx"> "mat4" { return MATRIX4; }
</span><span class="cx">
</span><ins>+"mat2x2" { return ES2_ident_ES3_keyword(context, MATRIX2); }
+"mat3x3" { return ES2_ident_ES3_keyword(context, MATRIX3); }
+"mat4x4" { return ES2_ident_ES3_keyword(context, MATRIX4); }
+
+"mat2x3" { return ES2_ident_ES3_keyword(context, MATRIX2x3); }
+"mat3x2" { return ES2_ident_ES3_keyword(context, MATRIX3x2); }
+"mat2x4" { return ES2_ident_ES3_keyword(context, MATRIX2x4); }
+"mat4x2" { return ES2_ident_ES3_keyword(context, MATRIX4x2); }
+"mat3x4" { return ES2_ident_ES3_keyword(context, MATRIX3x4); }
+"mat4x3" { return ES2_ident_ES3_keyword(context, MATRIX4x3); }
+
</ins><span class="cx"> "vec2" { return VEC2; }
</span><span class="cx"> "vec3" { return VEC3; }
</span><span class="cx"> "vec4" { return VEC4; }
</span><span class="lines">@@ -120,70 +154,160 @@
</span><span class="cx"> "bvec2" { return BVEC2; }
</span><span class="cx"> "bvec3" { return BVEC3; }
</span><span class="cx"> "bvec4" { return BVEC4; }
</span><ins>+"uvec2" { return ES2_ident_ES3_keyword(context, UVEC2); }
+"uvec3" { return ES2_ident_ES3_keyword(context, UVEC3); }
+"uvec4" { return ES2_ident_ES3_keyword(context, UVEC4); }
</ins><span class="cx">
</span><del>-"sampler2D" { return SAMPLER2D; }
-"samplerCube" { return SAMPLERCUBE; }
-"samplerExternalOES" { return SAMPLER_EXTERNAL_OES; }
-"sampler2DRect" { return SAMPLER2DRECT; }
</del><ins>+"sampler2D" { return SAMPLER2D; }
+"samplerCube" { return SAMPLERCUBE; }
+"samplerExternalOES" { return SAMPLER_EXTERNAL_OES; }
+"sampler3D" { return ES2_reserved_ES3_keyword(context, SAMPLER3D); }
+"sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
+"sampler2DRect" { return SAMPLER2DRECT; }
+"sampler2DArray" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
+"isampler2D" { return ES2_ident_ES3_keyword(context, ISAMPLER2D); }
+"isampler3D" { return ES2_ident_ES3_keyword(context, ISAMPLER3D); }
+"isamplerCube" { return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); }
+"isampler2DArray" { return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); }
+"usampler2D" { return ES2_ident_ES3_keyword(context, USAMPLER2D); }
+"usampler3D" { return ES2_ident_ES3_keyword(context, USAMPLER3D); }
+"usamplerCube" { return ES2_ident_ES3_keyword(context, USAMPLERCUBE); }
+"usampler2DArray" { return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); }
+"sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
+"samplerCubeShadow" { return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); }
+"sampler2DArrayShadow" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
</ins><span class="cx">
</span><span class="cx"> "struct" { return STRUCT; }
</span><span class="cx">
</span><del>-"asm" { return reserved_word(yyscanner); }
</del><ins>+"layout" { return ES2_ident_ES3_keyword(context, LAYOUT); }
</ins><span class="cx">
</span><del>-"class" { return reserved_word(yyscanner); }
-"union" { return reserved_word(yyscanner); }
-"enum" { return reserved_word(yyscanner); }
-"typedef" { return reserved_word(yyscanner); }
-"template" { return reserved_word(yyscanner); }
-"this" { return reserved_word(yyscanner); }
-"packed" { return reserved_word(yyscanner); }
</del><ins>+ /* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
+"coherent" |
+"restrict" |
+"readonly" |
+"writeonly" |
+"resource" |
+"atomic_uint" |
+"noperspective" |
+"patch" |
+"sample" |
+"subroutine" |
+"common" |
+"partition" |
+"active" |
</ins><span class="cx">
</span><del>-"goto" { return reserved_word(yyscanner); }
-"switch" { return reserved_word(yyscanner); }
-"default" { return reserved_word(yyscanner); }
</del><ins>+"filter" |
+"image1D" |
+"image2D" |
+"image3D" |
+"imageCube"         |
+"iimage1D" |
+"iimage2D" |
+"iimage3D" |
+"iimageCube" |
+"uimage1D" |
+"uimage2D" |
+"uimage3D" |
+"uimageCube" |
+"image1DArray" |
+"image2DArray" |
+"iimage1DArray" |
+"iimage2DArray" |
+"uimage1DArray" |
+"uimage2DArray" |
+"image1DShadow" |
+"image2DShadow" |
+"image1DArrayShadow" |
+"image2DArrayShadow" |
+"imageBuffer" |
+"iimageBuffer" |
+"uimageBuffer" |
</ins><span class="cx">
</span><del>-"inline" { return reserved_word(yyscanner); }
-"noinline" { return reserved_word(yyscanner); }
-"volatile" { return reserved_word(yyscanner); }
-"public" { return reserved_word(yyscanner); }
-"static" { return reserved_word(yyscanner); }
-"extern" { return reserved_word(yyscanner); }
-"external" { return reserved_word(yyscanner); }
-"interface" { return reserved_word(yyscanner); }
-"flat" { return reserved_word(yyscanner); }
</del><ins>+"sampler1DArray" |
+"sampler1DArrayShadow" |
+"isampler1D" |
+"isampler1DArray" |
+"usampler1D" |
+"usampler1DArray" |
+"isampler2DRect" |
+"usampler2DRect" |
+"samplerBuffer" |
+"isamplerBuffer" |
+"usamplerBuffer" |
+"sampler2DMS" |
+"isampler2DMS" |
+"usampler2DMS" |
+"sampler2DMSArray" |
+"isampler2DMSArray" |
+"usampler2DMSArray" {
+ if (context->shaderVersion < 300) {
+                yylval->lex.string = NewPoolTString(yytext);
+         return check_type(yyscanner);
+        }
+        return reserved_word(yyscanner);
+}
</ins><span class="cx">
</span><del>-"long" { return reserved_word(yyscanner); }
-"short" { return reserved_word(yyscanner); }
-"double" { return reserved_word(yyscanner); }
-"half" { return reserved_word(yyscanner); }
-"fixed" { return reserved_word(yyscanner); }
-"unsigned" { return reserved_word(yyscanner); }
-"superp" { return reserved_word(yyscanner); }
</del><ins>+ /* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
+"packed" {
+ if (context->shaderVersion >= 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
</ins><span class="cx">
</span><del>-"input" { return reserved_word(yyscanner); }
-"output" { return reserved_word(yyscanner); }
</del><ins>+ return reserved_word(yyscanner);
+}
</ins><span class="cx">
</span><del>-"hvec2" { return reserved_word(yyscanner); }
-"hvec3" { return reserved_word(yyscanner); }
-"hvec4" { return reserved_word(yyscanner); }
-"dvec2" { return reserved_word(yyscanner); }
-"dvec3" { return reserved_word(yyscanner); }
-"dvec4" { return reserved_word(yyscanner); }
-"fvec2" { return reserved_word(yyscanner); }
-"fvec3" { return reserved_word(yyscanner); }
-"fvec4" { return reserved_word(yyscanner); }
</del><ins>+ /* Reserved keywords */
+"asm" |
</ins><span class="cx">
</span><del>-"sampler1D" { return reserved_word(yyscanner); }
-"sampler3D" { return reserved_word(yyscanner); }
-"sampler1DShadow" { return reserved_word(yyscanner); }
-"sampler2DShadow" { return reserved_word(yyscanner); }
-"sampler3DRect" { return reserved_word(yyscanner); }
-"sampler2DRectShadow" { return reserved_word(yyscanner); }
</del><ins>+"class" |
+"union" |
+"enum" |
+"typedef" |
+"template" |
+"this" |
</ins><span class="cx">
</span><del>-"sizeof" { return reserved_word(yyscanner); }
-"cast" { return reserved_word(yyscanner); }
</del><ins>+"goto" |
</ins><span class="cx">
</span><del>-"namespace" { return reserved_word(yyscanner); }
</del><ins>+"inline" |
+"noinline" |
+"volatile" |
+"public" |
+"static" |
+"extern" |
+"external" |
+"interface" |
+
+"long" |
+"short" |
+"double" |
+"half" |
+"fixed" |
+"unsigned" |
+"superp" |
+
+"input" |
+"output" |
+
+"hvec2" |
+"hvec3" |
+"hvec4" |
+"dvec2" |
+"dvec3" |
+"dvec4" |
+"fvec2" |
+"fvec3" |
+"fvec4" |
+
+"sampler1D" |
+"sampler1DShadow" |
+"sampler2DRectShadow" |
+
+"sizeof" |
+"cast" |
+
+"namespace" |
</ins><span class="cx"> "using" { return reserved_word(yyscanner); }
</span><span class="cx">
</span><span class="cx"> {L}({L}|{D})* {
</span><span class="lines">@@ -195,10 +319,18 @@
</span><span class="cx"> 0{O}+ { return int_constant(yyscanner); }
</span><span class="cx"> {D}+ { return int_constant(yyscanner); }
</span><span class="cx">
</span><ins>+0[xX]{H}+[uU] { return uint_constant(context); }
+0{O}+[uU] { return uint_constant(context); }
+{D}+[uU] { return uint_constant(context); }
+
</ins><span class="cx"> {D}+{E} { return float_constant(yyscanner); }
</span><span class="cx"> {D}+"."{D}*({E})? { return float_constant(yyscanner); }
</span><span class="cx"> "."{D}+({E})? { return float_constant(yyscanner); }
</span><span class="cx">
</span><ins>+{D}+{E}[fF] { return floatsuffix_check(context); }
+{D}+"."{D}*({E})?[fF] { return floatsuffix_check(context); }
+"."{D}+({E})?[fF] { return floatsuffix_check(context); }
+
</ins><span class="cx"> "+=" { return ADD_ASSIGN; }
</span><span class="cx"> "-=" { return SUB_ASSIGN; }
</span><span class="cx"> "*=" { return MUL_ASSIGN; }
</span><span class="lines">@@ -224,34 +356,38 @@
</span><span class="cx"> ";" { return SEMICOLON; }
</span><span class="cx"> ("{"|"<%") { return LEFT_BRACE; }
</span><span class="cx"> ("}"|"%>") { return RIGHT_BRACE; }
</span><del>-"," { return COMMA; }
-":" { return COLON; }
-"=" { return EQUAL; }
-"(" { return LEFT_PAREN; }
-")" { return RIGHT_PAREN; }
-("["|"<:") { return LEFT_BRACKET; }
-("]"|":>") { return RIGHT_BRACKET; }
-"." { return DOT; }
-"!" { return BANG; }
-"-" { return DASH; }
-"~" { return TILDE; }
-"+" { return PLUS; }
-"*" { return STAR; }
-"/" { return SLASH; }
-"%" { return PERCENT; }
-"<" { return LEFT_ANGLE; }
-">" { return RIGHT_ANGLE; }
-"|" { return VERTICAL_BAR; }
-"^" { return CARET; }
-"&" { return AMPERSAND; }
-"?" { return QUESTION; }
</del><ins>+"," { return COMMA; }
+":" { return COLON; }
+"=" { return EQUAL; }
+"(" { return LEFT_PAREN; }
+")" { return RIGHT_PAREN; }
+("["|"<:") { return LEFT_BRACKET; }
+("]"|":>") { return RIGHT_BRACKET; }
+"." { return DOT; }
+"!" { return BANG; }
+"-" { return DASH; }
+"~" { return TILDE; }
+"+" { return PLUS; }
+"*" { return STAR; }
+"/" { return SLASH; }
+"%" { return PERCENT; }
+"<" { return LEFT_ANGLE; }
+">" { return RIGHT_ANGLE; }
+"|" { return VERTICAL_BAR; }
+"^" { return CARET; }
+"&" { return AMPERSAND; }
+"?" { return QUESTION; }
</ins><span class="cx">
</span><span class="cx"> [ \t\v\n\f\r] { }
</span><del>-<<EOF>> { yyterminate(); }
-. { assert(false); return 0; }
</del><ins>+<<EOF>> { yyterminate(); }
+. { assert(false); return 0; }
</ins><span class="cx">
</span><span class="cx"> %%
</span><span class="cx">
</span><ins>+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
</ins><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)->preprocessor.lex(&token);
</span><span class="lines">@@ -272,11 +408,12 @@
</span><span class="cx"> struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
</span><span class="cx">
</span><span class="cx"> int token = IDENTIFIER;
</span><del>- TSymbol* symbol = yyextra->symbolTable.find(yytext);
</del><ins>+ TSymbol* symbol = yyextra->symbolTable.find(yytext, yyextra->shaderVersion);
</ins><span class="cx"> if (symbol && symbol->isVariable()) {
</span><span class="cx"> TVariable* variable = static_cast<TVariable*>(symbol);
</span><del>- if (variable->isUserType())
</del><ins>+ if (variable->isUserType()) {
</ins><span class="cx"> token = TYPE_NAME;
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx"> yylval->lex.symbol = symbol;
</span><span class="cx"> return token;
</span><span class="lines">@@ -290,6 +427,80 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int ES2_reserved_ES3_keyword(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_keyword_ES3_reserved(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion >= 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_ident_ES3_keyword(TParseContext *context, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
+ if (context->shaderVersion < 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+
+ return token;
+}
+
+int uint_constant(TParseContext *context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
+ context->recover();
+ return 0;
+ }
+
+ if (!atoi_clamp(yytext, &(yylval->lex.i)))
+ yyextra->warning(*yylloc, "Integer overflow", yytext, "");
+
+ return UINTCONSTANT;
+}
+
+int floatsuffix_check(TParseContext* context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
+ context->recover();
+ return 0;
+ }
+
+ if (!atof_clamp(yytext, &(yylval->lex.f)))
+ yyextra->warning(*yylloc, "Float overflow", yytext, "");
+
+ return(FLOATCONSTANT);
+}
+
</ins><span class="cx"> void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) {
</span><span class="cx"> context->error(*lloc, reason, yyget_text(context->scanner));
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -339,7 +550,6 @@
</span><span class="cx"> // Initialize preprocessor.
</span><span class="cx"> if (!context->preprocessor.init(count, string, length))
</span><span class="cx"> return 1;
</span><del>- context->preprocessor.setMaxTokenLength(SH_MAX_TOKEN_LENGTH);
</del><span class="cx">
</span><span class="cx"> // Define extension macros.
</span><span class="cx"> const TExtensionBehavior& extBehavior = context->extensionBehavior();
</span><span class="lines">@@ -350,6 +560,8 @@
</span><span class="cx"> if (context->fragmentPrecisionHigh)
</span><span class="cx"> context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
</span><span class="cx">
</span><ins>+ context->preprocessor.setMaxTokenSize(GetGlobalMaxTokenSize(context->shaderSpec));
+
</ins><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslangy"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.y (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.y        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.y        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</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">@@ -15,7 +15,7 @@
</span><span class="cx">
</span><span class="cx"> %{
</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">@@ -41,18 +41,16 @@
</span><span class="cx"> #define YYENABLE_NLS 0
</span><span class="cx">
</span><span class="cx"> #define YYLEX_PARAM context->scanner
</span><del>-%}
</del><span class="cx">
</span><ins>+%}
</ins><span class="cx"> %expect 1 /* One shift reduce conflict because of if | else */
</span><span class="cx"> %pure-parser
</span><span class="cx"> %parse-param {TParseContext* context}
</span><span class="cx"> %locations
</span><del>-%lex-param {YYLEX_PARAM}
</del><span class="cx">
</span><span class="cx"> %code requires {
</span><span class="cx"> #define YYLTYPE TSourceLoc
</span><span class="cx"> #define YYLTYPE_IS_DECLARED 1
</span><del>-#define SH_MAX_TOKEN_LENGTH 256 // WebGL spec.
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> %union {
</span><span class="lines">@@ -61,6 +59,7 @@
</span><span class="cx"> TString *string;
</span><span class="cx"> float f;
</span><span class="cx"> int i;
</span><ins>+ unsigned int u;
</ins><span class="cx"> bool b;
</span><span class="cx"> };
</span><span class="cx"> TSymbol* symbol;
</span><span class="lines">@@ -76,6 +75,7 @@
</span><span class="cx"> union {
</span><span class="cx"> TPublicType type;
</span><span class="cx"> TPrecision precision;
</span><ins>+ TLayoutQualifier layoutQualifier;
</ins><span class="cx"> TQualifier qualifier;
</span><span class="cx"> TFunction* function;
</span><span class="cx"> TParameter param;
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">
</span><span class="cx"> #define YYLLOC_DEFAULT(Current, Rhs, N) \
</span><span class="cx"> do { \
</span><del>- if (N) { \
</del><ins>+ if (YYID(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">@@ -118,17 +118,38 @@
</span><span class="cx"> context->recover(); \
</span><span class="cx"> } \
</span><span class="cx"> }
</span><ins>+
+#define ES2_ONLY(S, L) { \
+ if (context->shaderVersion != 100) { \
+ context->error(L, " supported in GLSL ES 1.00 only ", S); \
+ context->recover(); \
+ } \
+}
+
+#define ES3_ONLY(TOKEN, LINE, REASON) { \
+ if (context->shaderVersion != 300) { \
+ context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
+ context->recover(); \
+ } \
+}
</ins><span class="cx"> %}
</span><span class="cx">
</span><span class="cx"> %token <lex> INVARIANT HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
</span><del>-%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE
-%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN
-%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4
</del><ins>+%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE UINT_TYPE
+%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
+%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4 UVEC2 UVEC3 UVEC4
</ins><span class="cx"> %token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
</span><ins>+%token <lex> MATRIX2x3 MATRIX3x2 MATRIX2x4 MATRIX4x2 MATRIX3x4 MATRIX4x3
+%token <lex> CENTROID FLAT SMOOTH
</ins><span class="cx"> %token <lex> STRUCT VOID_TYPE WHILE
</span><del>-%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT
</del><ins>+%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT SAMPLER2DARRAY
+%token <lex> ISAMPLER2D ISAMPLER3D ISAMPLERCUBE ISAMPLER2DARRAY
+%token <lex> USAMPLER2D USAMPLER3D USAMPLERCUBE USAMPLER2DARRAY
+%token <lex> SAMPLER3D SAMPLER3DRECT SAMPLER2DSHADOW SAMPLERCUBESHADOW SAMPLER2DARRAYSHADOW
+%token <lex> LAYOUT
</ins><span class="cx">
</span><del>-%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT
</del><ins>+%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
+%token <lex> FIELD_SELECTION
</ins><span class="cx"> %token <lex> LEFT_OP RIGHT_OP
</span><span class="cx"> %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
</span><span class="cx"> %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
</span><span class="lines">@@ -161,10 +182,11 @@
</span><span class="cx"> %type <interm> single_declaration init_declarator_list
</span><span class="cx">
</span><span class="cx"> %type <interm> parameter_declaration parameter_declarator parameter_type_specifier
</span><del>-%type <interm.qualifier> parameter_qualifier
</del><ins>+%type <interm.qualifier> parameter_qualifier parameter_type_qualifier
+%type <interm.layoutQualifier> layout_qualifier layout_qualifier_id_list layout_qualifier_id
</ins><span class="cx">
</span><span class="cx"> %type <interm.precision> precision_qualifier
</span><del>-%type <interm.type> type_qualifier fully_specified_type type_specifier
</del><ins>+%type <interm.type> type_qualifier fully_specified_type type_specifier storage_qualifier interpolation_qualifier
</ins><span class="cx"> %type <interm.type> type_specifier_no_prec type_specifier_nonarray
</span><span class="cx"> %type <interm.type> struct_specifier
</span><span class="cx"> %type <interm.field> struct_declarator
</span><span class="lines">@@ -174,6 +196,8 @@
</span><span class="cx"> %type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
</span><span class="cx"> %type <interm> function_call_or_method
</span><span class="cx">
</span><ins>+%type <lex> enter_struct
+
</ins><span class="cx"> %start translation_unit
</span><span class="cx"> %%
</span><span class="cx">
</span><span class="lines">@@ -201,7 +225,7 @@
</span><span class="cx"> {
</span><span class="cx"> variable = static_cast<const TVariable*>(symbol);
</span><span class="cx">
</span><del>- if (context->symbolTable.findBuiltIn(variable->getName()) &&
</del><ins>+ if (context->symbolTable.findBuiltIn(variable->getName(), context->shaderVersion) &&
</ins><span class="cx"> !variable->getExtension().empty() &&
</span><span class="cx"> context->extensionErrorCheck(@1, variable->getExtension()))
</span><span class="cx"> {
</span><span class="lines">@@ -213,7 +237,7 @@
</span><span class="cx"> {
</span><span class="cx"> TType type(EbtFloat, EbpUndefined);
</span><span class="cx"> TVariable *fakeVariable = new TVariable($1.string, type);
</span><del>- context->symbolTable.insert(*fakeVariable);
</del><ins>+ context->symbolTable.declare(*fakeVariable);
</ins><span class="cx"> variable = fakeVariable;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -245,6 +269,11 @@
</span><span class="cx"> unionArray->setIConst($1.i);
</span><span class="cx"> $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @1);
</span><span class="cx"> }
</span><ins>+ | UINTCONSTANT {
+ ConstantUnion *unionArray = new ConstantUnion[1];
+ unionArray->setUConst($1.u);
+ $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), @1);
+ }
</ins><span class="cx"> | FLOATCONSTANT {
</span><span class="cx"> ConstantUnion *unionArray = new ConstantUnion[1];
</span><span class="cx"> unionArray->setFConst($1.f);
</span><span class="lines">@@ -271,104 +300,12 @@
</span><span class="cx"> $$ = $1;
</span><span class="cx"> }
</span><span class="cx"> | postfix_expression DOT identifier {
</span><del>- if ($1->isArray()) {
- context->error(@3, "cannot apply dot operator to an array", ".");
- context->recover();
- }
-
- if ($1->isVector()) {
- TVectorFields fields;
- if (! context->parseVectorFields(*$3.string, $1->getNominalSize(), fields, @3)) {
- fields.num = 1;
- fields.offsets[0] = 0;
- context->recover();
- }
-
- if ($1->getType().getQualifier() == EvqConst) { // constant folding for vector fields
- $$ = context->addConstVectorNode(fields, $1, @3);
- if ($$ == 0) {
- context->recover();
- $$ = $1;
- }
- else
- $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqConst, (int) (*$3.string).size()));
- } else {
- TString vectorString = *$3.string;
- TIntermTyped* index = context->intermediate.addSwizzle(fields, @3);
- $$ = context->intermediate.addIndex(EOpVectorSwizzle, $1, index, @2);
- $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, (int) vectorString.size()));
- }
- } else if ($1->isMatrix()) {
- TMatrixFields fields;
- if (! context->parseMatrixFields(*$3.string, $1->getNominalSize(), fields, @3)) {
- fields.wholeRow = false;
- fields.wholeCol = false;
- fields.row = 0;
- fields.col = 0;
- context->recover();
- }
-
- if (fields.wholeRow || fields.wholeCol) {
- context->error(@2, " non-scalar fields not implemented yet", ".");
- context->recover();
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(0);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @3);
- $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, @2);
- $$->setType(TType($1->getBasicType(), $1->getPrecision(),EvqTemporary, $1->getNominalSize()));
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(fields.col * $1->getNominalSize() + fields.row);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @3);
- $$ = context->intermediate.addIndex(EOpIndexDirect, $1, index, @2);
- $$->setType(TType($1->getBasicType(), $1->getPrecision()));
- }
- } else if ($1->getBasicType() == EbtStruct) {
- bool fieldFound = false;
- const TFieldList& fields = $1->getType().getStruct()->fields();
- unsigned int i;
- for (i = 0; i < fields.size(); ++i) {
- if (fields[i]->name() == *$3.string) {
- fieldFound = true;
- break;
- }
- }
- if (fieldFound) {
- if ($1->getType().getQualifier() == EvqConst) {
- $$ = context->addConstStruct(*$3.string, $1, @2);
- if ($$ == 0) {
- context->recover();
- $$ = $1;
- }
- else {
- $$->setType(*fields[i]->type());
- // change the qualifier of the return type, not of the structure field
- // as the structure definition is shared between various structures.
- $$->getTypePointer()->setQualifier(EvqConst);
- }
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(i);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), @3);
- $$ = context->intermediate.addIndex(EOpIndexDirectStruct, $1, index, @2);
- $$->setType(*fields[i]->type());
- }
- } else {
- context->error(@2, " no such field in structure", $3.string->c_str());
- context->recover();
- $$ = $1;
- }
- } else {
- context->error(@2, " field selection requires structure, vector, or matrix on left hand side", $3.string->c_str());
- context->recover();
- $$ = $1;
- }
- // don't delete $3.string, it's from the pool
</del><ins>+ $$ = context->addFieldSelectionExpression($1, @2, *$3.string, @3);
</ins><span class="cx"> }
</span><span class="cx"> | postfix_expression INC_OP {
</span><span class="cx"> if (context->lValueErrorCheck(@2, "++", $1))
</span><span class="cx"> context->recover();
</span><del>- $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addUnaryMath(EOpPostIncrement, $1, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->unaryOpError(@2, "++", $1->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -378,7 +315,7 @@
</span><span class="cx"> | postfix_expression DEC_OP {
</span><span class="cx"> if (context->lValueErrorCheck(@2, "--", $1))
</span><span class="cx"> context->recover();
</span><del>- $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addUnaryMath(EOpPostDecrement, $1, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->unaryOpError(@2, "--", $1->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -428,7 +365,7 @@
</span><span class="cx"> //
</span><span class="cx"> const TFunction* fnCandidate;
</span><span class="cx"> bool builtIn;
</span><del>- fnCandidate = context->findFunction(@1, fnCall, &builtIn);
</del><ins>+ fnCandidate = context->findFunction(@1, fnCall, context->shaderVersion, &builtIn);
</ins><span class="cx"> if (fnCandidate) {
</span><span class="cx"> //
</span><span class="cx"> // A declared function.
</span><span class="lines">@@ -446,7 +383,7 @@
</span><span class="cx"> //
</span><span class="cx"> // Treat it like a built-in unary operator.
</span><span class="cx"> //
</span><del>- $$ = context->intermediate.addUnaryMath(op, $1.intermNode, @1, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addUnaryMath(op, $1.intermNode, @1);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> std::stringstream extraInfoStream;
</span><span class="cx"> extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>($1.intermNode)->getCompleteString();
</span><span class="lines">@@ -551,59 +488,7 @@
</span><span class="cx">
</span><span class="cx"> function_identifier
</span><span class="cx"> : type_specifier_nonarray {
</span><del>- //
- // Constructor
- //
- TOperator op = EOpNull;
- if ($1.userDef) {
- op = EOpConstructStruct;
- } else {
- switch ($1.type) {
- case EbtFloat:
- if ($1.matrix) {
- switch($1.size) {
- case 2: op = EOpConstructMat2; break;
- case 3: op = EOpConstructMat3; break;
- case 4: op = EOpConstructMat4; break;
- }
- } else {
- switch($1.size) {
- case 1: op = EOpConstructFloat; break;
- case 2: op = EOpConstructVec2; break;
- case 3: op = EOpConstructVec3; break;
- case 4: op = EOpConstructVec4; break;
- }
- }
- break;
- case EbtInt:
- switch($1.size) {
- case 1: op = EOpConstructInt; break;
- case 2: op = EOpConstructIVec2; break;
- case 3: op = EOpConstructIVec3; break;
- case 4: op = EOpConstructIVec4; break;
- }
- break;
- case EbtBool:
- switch($1.size) {
- case 1: op = EOpConstructBool; break;
- case 2: op = EOpConstructBVec2; break;
- case 3: op = EOpConstructBVec3; break;
- case 4: op = EOpConstructBVec4; break;
- }
- break;
- default: break;
- }
- if (op == EOpNull) {
- context->error(@1, "cannot construct this type", getBasicString($1.type));
- context->recover();
- $1.type = EbtFloat;
- op = EOpConstructFloat;
- }
- }
- TString tempString;
- TType type($1);
- TFunction *function = new TFunction(&tempString, type, op);
- $$ = function;
</del><ins>+ $$ = context->addConstructorFunc($1);
</ins><span class="cx"> }
</span><span class="cx"> | IDENTIFIER {
</span><span class="cx"> if (context->reservedErrorCheck(@1, *$1.string))
</span><span class="lines">@@ -621,7 +506,7 @@
</span><span class="cx"> | INC_OP unary_expression {
</span><span class="cx"> if (context->lValueErrorCheck(@1, "++", $2))
</span><span class="cx"> context->recover();
</span><del>- $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, @1, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addUnaryMath(EOpPreIncrement, $2, @1);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->unaryOpError(@1, "++", $2->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -631,7 +516,7 @@
</span><span class="cx"> | DEC_OP unary_expression {
</span><span class="cx"> if (context->lValueErrorCheck(@1, "--", $2))
</span><span class="cx"> context->recover();
</span><del>- $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, @1, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addUnaryMath(EOpPreDecrement, $2, @1);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->unaryOpError(@1, "--", $2->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -640,7 +525,7 @@
</span><span class="cx"> }
</span><span class="cx"> | unary_operator unary_expression {
</span><span class="cx"> if ($1.op != EOpNull) {
</span><del>- $$ = context->intermediate.addUnaryMath($1.op, $2, @1, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addUnaryMath($1.op, $2, @1);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> const char* errorOp = "";
</span><span class="cx"> switch($1.op) {
</span><span class="lines">@@ -668,7 +553,7 @@
</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->intermediate.addBinaryMath(EOpMul, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "*", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -676,7 +561,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> | multiplicative_expression SLASH unary_expression {
</span><del>- $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "/", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -688,7 +573,7 @@
</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->intermediate.addBinaryMath(EOpAdd, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpAdd, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "+", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -696,7 +581,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> | additive_expression DASH multiplicative_expression {
</span><del>- $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpSub, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "-", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -712,7 +597,7 @@
</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->intermediate.addBinaryMath(EOpLessThan, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpLessThan, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "<", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -722,7 +607,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> | relational_expression RIGHT_ANGLE shift_expression {
</span><del>- $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpGreaterThan, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, ">", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -732,7 +617,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> | relational_expression LE_OP shift_expression {
</span><del>- $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "<=", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -742,7 +627,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> | relational_expression GE_OP shift_expression {
</span><del>- $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, ">=", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -756,7 +641,7 @@
</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->intermediate.addBinaryMath(EOpEqual, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpEqual, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "==", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -766,7 +651,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> | equality_expression NE_OP relational_expression {
</span><del>- $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpNotEqual, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "!=", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -792,7 +677,7 @@
</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->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "&&", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -806,7 +691,7 @@
</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->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpLogicalXor, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "^^", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -820,7 +705,7 @@
</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->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, @2, context->symbolTable);
</del><ins>+ $$ = context->intermediate.addBinaryMath(EOpLogicalOr, $1, $3, @2);
</ins><span class="cx"> if ($$ == 0) {
</span><span class="cx"> context->binaryOpError(@2, "||", $1->getCompleteString(), $3->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -893,6 +778,14 @@
</span><span class="cx"> }
</span><span class="cx"> ;
</span><span class="cx">
</span><ins>+enter_struct
+ : IDENTIFIER LEFT_BRACE {
+ if (context->enterStructDeclaration(@1, *$1.string))
+ context->recover();
+ $$ = $1;
+ }
+ ;
+
</ins><span class="cx"> declaration
</span><span class="cx"> : function_prototype SEMICOLON {
</span><span class="cx"> TFunction &function = *($1.function);
</span><span class="lines">@@ -937,6 +830,22 @@
</span><span class="cx"> }
</span><span class="cx"> $$ = 0;
</span><span class="cx"> }
</span><ins>+ | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON {
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, NULL, @$, NULL, @$);
+ }
+ | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON {
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, NULL, @$);
+ }
+ | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET SEMICOLON {
+ ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
+ $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, $7, @6);
+ }
+ | type_qualifier SEMICOLON {
+ context->parseGlobalLayoutQualifier($1);
+ $$ = 0;
+ }
</ins><span class="cx"> ;
</span><span class="cx">
</span><span class="cx"> function_prototype
</span><span class="lines">@@ -949,7 +858,7 @@
</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<TFunction*>(context->symbolTable.find($1->getMangledName()));
</del><ins>+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find($1->getMangledName(), context->shaderVersion));
</ins><span class="cx"> if (prevDec) {
</span><span class="cx"> if (prevDec->getReturnType() != $1->getReturnType()) {
</span><span class="cx"> context->error(@2, "overloaded functions must have the same return type", $1->getReturnType().getBasicString());
</span><span class="lines">@@ -966,7 +875,7 @@
</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->symbolTable.find($1->getName());
</del><ins>+ TSymbol *prevSym = context->symbolTable.find($1->getName(), context->shaderVersion);
</ins><span class="cx"> if (prevSym)
</span><span class="cx"> {
</span><span class="cx"> if (!prevSym->isFunction())
</span><span class="lines">@@ -1093,9 +1002,9 @@
</span><span class="cx"> //
</span><span class="cx"> // Type + name
</span><span class="cx"> //
</span><del>- : type_qualifier parameter_qualifier parameter_declarator {
</del><ins>+ : parameter_type_qualifier parameter_qualifier parameter_declarator {
</ins><span class="cx"> $$ = $3;
</span><del>- if (context->paramErrorCheck(@3, $1.qualifier, $2, $$.param.type))
</del><ins>+ if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
</ins><span class="cx"> context->recover();
</span><span class="cx"> }
</span><span class="cx"> | parameter_qualifier parameter_declarator {
</span><span class="lines">@@ -1108,9 +1017,9 @@
</span><span class="cx"> //
</span><span class="cx"> // Only type
</span><span class="cx"> //
</span><del>- | type_qualifier parameter_qualifier parameter_type_specifier {
</del><ins>+ | parameter_type_qualifier parameter_qualifier parameter_type_specifier {
</ins><span class="cx"> $$ = $3;
</span><del>- if (context->paramErrorCheck(@3, $1.qualifier, $2, $$.param.type))
</del><ins>+ if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
</ins><span class="cx"> context->recover();
</span><span class="cx"> }
</span><span class="cx"> | parameter_qualifier parameter_type_specifier {
</span><span class="lines">@@ -1149,173 +1058,46 @@
</span><span class="cx"> $$ = $1;
</span><span class="cx"> }
</span><span class="cx"> | init_declarator_list COMMA identifier {
</span><del>- if ($1.type.type == EbtInvariant && !$3.symbol)
- {
- context->error(@3, "undeclared identifier declared as invariant", $3.string->c_str());
- context->recover();
- }
-
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$3.string, TType($1.type), @3);
- $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, symbol, @3);
-
- if (context->structQualifierErrorCheck(@3, $$.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@3, *$3.string, $$.type, false))
- context->recover();
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck(@3, *$3.string, $$.type, variable))
- context->recover();
- if (symbol && variable)
- symbol->setId(variable->getUniqueId());
</del><ins>+ $$ = $1;
+ $$.intermAggregate = context->parseDeclarator($$.type, $1.intermAggregate, $3.symbol, @3, *$3.string);
</ins><span class="cx"> }
</span><span class="cx"> | init_declarator_list COMMA identifier LEFT_BRACKET RIGHT_BRACKET {
</span><del>- if (context->structQualifierErrorCheck(@3, $1.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@3, *$3.string, $1.type, true))
- context->recover();
-
</del><span class="cx"> $$ = $1;
</span><del>-
- if (context->arrayTypeErrorCheck(@4, $1.type) || context->arrayQualifierErrorCheck(@4, $1.type))
- context->recover();
- else {
- $1.type.setArray(true);
- TVariable* variable;
- if (context->arrayErrorCheck(@4, *$3.string, $1.type, variable))
- context->recover();
- }
</del><ins>+ context->parseArrayDeclarator($$.type, @3, *$3.string, @4, NULL, NULL);
</ins><span class="cx"> }
</span><span class="cx"> | init_declarator_list COMMA identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
</span><del>- if (context->structQualifierErrorCheck(@3, $1.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@3, *$3.string, $1.type, true))
- context->recover();
-
</del><span class="cx"> $$ = $1;
</span><del>-
- if (context->arrayTypeErrorCheck(@4, $1.type) || context->arrayQualifierErrorCheck(@4, $1.type))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck(@4, $5, size))
- context->recover();
- $1.type.setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck(@4, *$3.string, $1.type, variable))
- context->recover();
- TType type = TType($1.type);
- type.setArraySize(size);
- $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *$3.string, type, @3), @3);
- }
</del><ins>+ $$.intermAggregate = context->parseArrayDeclarator($$.type, @3, *$3.string, @4, $1.intermNode, $5);
</ins><span class="cx"> }
</span><span class="cx"> | init_declarator_list COMMA identifier EQUAL initializer {
</span><del>- if (context->structQualifierErrorCheck(@3, $1.type))
- context->recover();
-
</del><span class="cx"> $$ = $1;
</span><del>-
- TIntermNode* intermNode;
- if (!context->executeInitializer(@3, *$3.string, $1.type, $5, intermNode)) {
- //
- // build the intermediate representation
- //
- if (intermNode)
- $$.intermAggregate = context->intermediate.growAggregate($1.intermNode, intermNode, @4);
- else
- $$.intermAggregate = $1.intermAggregate;
- } else {
- context->recover();
- $$.intermAggregate = 0;
- }
</del><ins>+ $$.intermAggregate = context->parseInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
</ins><span class="cx"> }
</span><span class="cx"> ;
</span><span class="cx">
</span><span class="cx"> single_declaration
</span><span class="cx"> : fully_specified_type {
</span><span class="cx"> $$.type = $1;
</span><del>- $$.intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType($1), @1), @1);
</del><ins>+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @1, "");
</ins><span class="cx"> }
</span><span class="cx"> | fully_specified_type identifier {
</span><del>- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, TType($1), @2);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
-
- if (context->structQualifierErrorCheck(@2, $$.type))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@2, *$2.string, $$.type, false))
- context->recover();
-
- $$.type = $1;
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck(@2, *$2.string, $$.type, variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
</del><ins>+ $$.type = $1;
+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @2, *$2.string);
</ins><span class="cx"> }
</span><span class="cx"> | fully_specified_type identifier LEFT_BRACKET RIGHT_BRACKET {
</span><span class="cx"> context->error(@2, "unsized array declarations not supported", $2.string->c_str());
</span><span class="cx"> context->recover();
</span><span class="cx">
</span><del>- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, TType($1), @2);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
</del><span class="cx"> $$.type = $1;
</span><ins>+ $$.intermAggregate = context->parseSingleDeclaration($$.type, @2, *$2.string);
</ins><span class="cx"> }
</span><span class="cx"> | fully_specified_type identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
</span><del>- TType type = TType($1);
- int size;
- if (context->arraySizeErrorCheck(@2, $4, size))
- context->recover();
- type.setArraySize(size);
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *$2.string, type, @2);
- $$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
-
- if (context->structQualifierErrorCheck(@2, $1))
- context->recover();
-
- if (context->nonInitConstErrorCheck(@2, *$2.string, $1, true))
- context->recover();
-
</del><span class="cx"> $$.type = $1;
</span><del>-
- if (context->arrayTypeErrorCheck(@3, $1) || context->arrayQualifierErrorCheck(@3, $1))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck(@3, $4, size))
- context->recover();
-
- $1.setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck(@3, *$2.string, $1, variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
- }
</del><ins>+ $$.intermAggregate = context->parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, $4);
</ins><span class="cx"> }
</span><span class="cx"> | fully_specified_type identifier EQUAL initializer {
</span><del>- if (context->structQualifierErrorCheck(@2, $1))
- context->recover();
-
</del><span class="cx"> $$.type = $1;
</span><del>-
- TIntermNode* intermNode;
- if (!context->executeInitializer(@2, *$2.string, $1, $4, intermNode)) {
- //
- // Build intermediate representation
- //
- if(intermNode)
- $$.intermAggregate = context->intermediate.makeAggregate(intermNode, @3);
- else
- $$.intermAggregate = 0;
- } else {
- context->recover();
- $$.intermAggregate = 0;
- }
</del><ins>+ $$.intermAggregate = context->parseSingleInitDeclaration($$.type, @2, *$2.string, @3, $4);
</ins><span class="cx"> }
</span><span class="cx"> | INVARIANT IDENTIFIER {
</span><span class="cx"> VERTEX_ONLY("invariant declaration", @1);
</span><span class="lines">@@ -1348,38 +1130,35 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> | type_qualifier type_specifier {
</span><del>- if ($2.array) {
- context->error(@2, "not supported", "first-class array");
- context->recover();
- $2.setArray(false);
- }
</del><ins>+ $$ = context->addFullySpecifiedType($1.qualifier, $1.layoutQualifier, $2);
+ }
+ ;
</ins><span class="cx">
</span><del>- if ($1.qualifier == EvqAttribute &&
- ($2.type == EbtBool || $2.type == EbtInt)) {
- context->error(@2, "cannot be bool or int", getQualifierString($1.qualifier));
- context->recover();
- }
- if (($1.qualifier == EvqVaryingIn || $1.qualifier == EvqVaryingOut) &&
- ($2.type == EbtBool || $2.type == EbtInt)) {
- context->error(@2, "cannot be bool or int", getQualifierString($1.qualifier));
- context->recover();
- }
- $$ = $2;
- $$.qualifier = $1.qualifier;
</del><ins>+interpolation_qualifier
+ : SMOOTH {
+ $$.qualifier = EvqSmooth;
</ins><span class="cx"> }
</span><ins>+ | FLAT {
+ $$.qualifier = EvqFlat;
+ }
</ins><span class="cx"> ;
</span><span class="cx">
</span><del>-type_qualifier
</del><ins>+parameter_type_qualifier
</ins><span class="cx"> : CONST_QUAL {
</span><del>- $$.setBasic(EbtVoid, EvqConst, @1);
</del><ins>+ $$ = EvqConst;
</ins><span class="cx"> }
</span><del>- | ATTRIBUTE {
</del><ins>+ ;
+
+type_qualifier
+ : ATTRIBUTE {
</ins><span class="cx"> VERTEX_ONLY("attribute", @1);
</span><ins>+ ES2_ONLY("attribute", @1);
</ins><span class="cx"> if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "attribute"))
</span><span class="cx"> context->recover();
</span><span class="cx"> $$.setBasic(EbtVoid, EvqAttribute, @1);
</span><span class="cx"> }
</span><span class="cx"> | VARYING {
</span><ins>+ ES2_ONLY("varying", @1);
</ins><span class="cx"> if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying"))
</span><span class="cx"> context->recover();
</span><span class="cx"> if (context->shaderType == SH_VERTEX_SHADER)
</span><span class="lines">@@ -1388,6 +1167,7 @@
</span><span class="cx"> $$.setBasic(EbtVoid, EvqVaryingIn, @1);
</span><span class="cx"> }
</span><span class="cx"> | INVARIANT VARYING {
</span><ins>+ ES2_ONLY("varying", @1);
</ins><span class="cx"> if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
</span><span class="cx"> context->recover();
</span><span class="cx"> if (context->shaderType == SH_VERTEX_SHADER)
</span><span class="lines">@@ -1395,10 +1175,68 @@
</span><span class="cx"> else
</span><span class="cx"> $$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
</span><span class="cx"> }
</span><ins>+ | storage_qualifier {
+ if ($1.qualifier != EvqConst && !context->symbolTable.atGlobalLevel()) {
+ context->error(@1, "Local variables can only use the const storage qualifier.", getQualifierString($1.qualifier));
+ context->recover();
+ } else {
+ $$.setBasic(EbtVoid, $1.qualifier, @1);
+ }
+ }
+ | interpolation_qualifier storage_qualifier {
+ $$ = context->joinInterpolationQualifiers(@1, $1.qualifier, @2, $2.qualifier);
+ }
+ | interpolation_qualifier {
+ context->error(@1, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString($1.qualifier));
+ context->recover();
+
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtVoid, qual, @1);
+ }
+ | layout_qualifier {
+ $$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.layoutQualifier = $1;
+ }
+ | layout_qualifier storage_qualifier {
+ $$.setBasic(EbtVoid, $2.qualifier, @2);
+ $$.layoutQualifier = $1;
+ }
+ ;
+
+storage_qualifier
+ : CONST_QUAL {
+ $$.qualifier = EvqConst;
+ }
+ | IN_QUAL {
+ ES3_ONLY("in", @1, "storage qualifier");
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
+ }
+ | OUT_QUAL {
+ ES3_ONLY("out", @1, "storage qualifier");
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
+ }
+ | CENTROID IN_QUAL {
+ ES3_ONLY("centroid in", @1, "storage qualifier");
+ if (context->shaderType == SH_VERTEX_SHADER)
+ {
+ context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
+ context->recover();
+ }
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
+ }
+ | CENTROID OUT_QUAL {
+ ES3_ONLY("centroid out", @1, "storage qualifier");
+ if (context->shaderType == SH_FRAGMENT_SHADER)
+ {
+ context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
+ context->recover();
+ }
+ $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
+ }
</ins><span class="cx"> | UNIFORM {
</span><span class="cx"> if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
</span><span class="cx"> context->recover();
</span><del>- $$.setBasic(EbtVoid, EvqUniform, @1);
</del><ins>+ $$.qualifier = EvqUniform;
</ins><span class="cx"> }
</span><span class="cx"> ;
</span><span class="cx">
</span><span class="lines">@@ -1431,6 +1269,34 @@
</span><span class="cx"> }
</span><span class="cx"> ;
</span><span class="cx">
</span><ins>+layout_qualifier
+ : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
+ ES3_ONLY("layout", @1, "qualifier");
+ $$ = $3;
+ }
+ ;
+
+layout_qualifier_id_list
+ : layout_qualifier_id {
+ $$ = $1;
+ }
+ | layout_qualifier_id_list COMMA layout_qualifier_id {
+ $$ = context->joinLayoutQualifiers($1, $3);
+ }
+ ;
+
+layout_qualifier_id
+ : IDENTIFIER {
+ $$ = context->parseLayoutQualifier(*$1.string, @1);
+ }
+ | IDENTIFIER EQUAL INTCONSTANT {
+ $$ = context->parseLayoutQualifier(*$1.string, @1, *$3.string, $3.i, @3);
+ }
+ | IDENTIFIER EQUAL UINTCONSTANT {
+ $$ = context->parseLayoutQualifier(*$1.string, @1, *$3.string, $3.i, @3);
+ }
+ ;
+
</ins><span class="cx"> type_specifier_no_prec
</span><span class="cx"> : type_specifier_nonarray {
</span><span class="cx"> $$ = $1;
</span><span class="lines">@@ -1462,6 +1328,10 @@
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> $$.setBasic(EbtInt, qual, @1);
</span><span class="cx"> }
</span><ins>+ | UINT_TYPE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ }
</ins><span class="cx"> | BOOL_TYPE {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> $$.setBasic(EbtBool, qual, @1);
</span><span class="lines">@@ -1511,29 +1381,126 @@
</span><span class="cx"> $$.setBasic(EbtInt, qual, @1);
</span><span class="cx"> $$.setAggregate(4);
</span><span class="cx"> }
</span><ins>+ | UVEC2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ $$.setAggregate(2);
+ }
+ | UVEC3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ $$.setAggregate(3);
+ }
+ | UVEC4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUInt, qual, @1);
+ $$.setAggregate(4);
+ }
</ins><span class="cx"> | MATRIX2 {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> $$.setBasic(EbtFloat, qual, @1);
</span><del>- $$.setAggregate(2, true);
</del><ins>+ $$.setMatrix(2, 2);
</ins><span class="cx"> }
</span><span class="cx"> | MATRIX3 {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> $$.setBasic(EbtFloat, qual, @1);
</span><del>- $$.setAggregate(3, true);
</del><ins>+ $$.setMatrix(3, 3);
</ins><span class="cx"> }
</span><span class="cx"> | MATRIX4 {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> $$.setBasic(EbtFloat, qual, @1);
</span><del>- $$.setAggregate(4, true);
</del><ins>+ $$.setMatrix(4, 4);
</ins><span class="cx"> }
</span><ins>+ | MATRIX2x3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(2, 3);
+ }
+ | MATRIX3x2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(3, 2);
+ }
+ | MATRIX2x4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(2, 4);
+ }
+ | MATRIX4x2 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(4, 2);
+ }
+ | MATRIX3x4 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(3, 4);
+ }
+ | MATRIX4x3 {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtFloat, qual, @1);
+ $$.setMatrix(4, 3);
+ }
</ins><span class="cx"> | SAMPLER2D {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> $$.setBasic(EbtSampler2D, qual, @1);
</span><span class="cx"> }
</span><ins>+ | SAMPLER3D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler3D, qual, @1);
+ }
</ins><span class="cx"> | SAMPLERCUBE {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> $$.setBasic(EbtSamplerCube, qual, @1);
</span><span class="cx"> }
</span><ins>+ | SAMPLER2DARRAY {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler2DArray, qual, @1);
+ }
+ | ISAMPLER2D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISampler2D, qual, @1);
+ }
+ | ISAMPLER3D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISampler3D, qual, @1);
+ }
+ | ISAMPLERCUBE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISamplerCube, qual, @1);
+ }
+ | ISAMPLER2DARRAY {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtISampler2DArray, qual, @1);
+ }
+ | USAMPLER2D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSampler2D, qual, @1);
+ }
+ | USAMPLER3D {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSampler3D, qual, @1);
+ }
+ | USAMPLERCUBE {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSamplerCube, qual, @1);
+ }
+ | USAMPLER2DARRAY {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtUSampler2DArray, qual, @1);
+ }
+ | SAMPLER2DSHADOW {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler2DShadow, qual, @1);
+ }
+ | SAMPLERCUBESHADOW {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSamplerCubeShadow, qual, @1);
+ }
+ | SAMPLER2DARRAYSHADOW {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ $$.setBasic(EbtSampler2DArrayShadow, qual, @1);
+ }
</ins><span class="cx"> | SAMPLER_EXTERNAL_OES {
</span><span class="cx"> if (!context->supportsExtension("GL_OES_EGL_image_external")) {
</span><span class="cx"> context->error(@1, "unsupported type", "samplerExternalOES");
</span><span class="lines">@@ -1568,24 +1535,10 @@
</span><span class="cx">
</span><span class="cx"> struct_specifier
</span><span class="cx"> : STRUCT identifier LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
</span><del>- if (context->reservedErrorCheck(@2, *$2.string))
- context->recover();
-
- TType* structure = new TType(new TStructure($2.string, $5));
- TVariable* userTypeDef = new TVariable($2.string, *structure, true);
- if (! context->symbolTable.insert(*userTypeDef)) {
- context->error(@2, "redefinition", $2.string->c_str(), "struct");
- context->recover();
- }
- $$.setBasic(EbtStruct, EvqTemporary, @1);
- $$.userDef = structure;
- context->exitStructDeclaration();
</del><ins>+ $$ = context->addStructure(@1, @2, $2.string, $5);
</ins><span class="cx"> }
</span><span class="cx"> | STRUCT LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
</span><del>- TType* structure = new TType(new TStructure(NewPoolTString(""), $4));
- $$.setBasic(EbtStruct, EvqTemporary, @1);
- $$.userDef = structure;
- context->exitStructDeclaration();
</del><ins>+ $$ = context->addStructure(@1, @$, NewPoolTString(""), $4);
</ins><span class="cx"> }
</span><span class="cx"> ;
</span><span class="cx">
</span><span class="lines">@@ -1610,35 +1563,14 @@
</span><span class="cx">
</span><span class="cx"> struct_declaration
</span><span class="cx"> : type_specifier struct_declarator_list SEMICOLON {
</span><del>- $$ = $2;
-
- if (context->voidErrorCheck(@1, (*$2)[0]->name(), $1)) {
- context->recover();
- }
- for (unsigned int i = 0; i < $$->size(); ++i) {
- //
- // Careful not to replace already known aspects of type, like array-ness
- //
- TType* type = (*$$)[i]->type();
- type->setBasicType($1.type);
- type->setNominalSize($1.size);
- type->setMatrix($1.matrix);
- type->setPrecision($1.precision);
-
- // don't allow arrays of arrays
- if (type->isArray()) {
- if (context->arrayTypeErrorCheck(@1, $1))
- context->recover();
- }
- if ($1.array)
- type->setArraySize($1.arraySize);
- if ($1.userDef)
- type->setStruct($1.userDef->getStruct());
-
- if (context->structNestingErrorCheck(@1, *(*$$)[i]))
- context->recover();
- }
</del><ins>+ $$ = context->addStructDeclaratorList($1, $2);
</ins><span class="cx"> }
</span><ins>+ | type_qualifier type_specifier struct_declarator_list SEMICOLON {
+ // ES3 Only, but errors should be handled elsewhere
+ $2.qualifier = $1.qualifier;
+ $2.layoutQualifier = $1.layoutQualifier;
+ $$ = context->addStructDeclaratorList($2, $3);
+ }
</ins><span class="cx"> ;
</span><span class="cx">
</span><span class="cx"> struct_declarator_list
</span><span class="lines">@@ -1657,19 +1589,19 @@
</span><span class="cx"> context->recover();
</span><span class="cx">
</span><span class="cx"> TType* type = new TType(EbtVoid, EbpUndefined);
</span><del>- $$ = new TField(type, $1.string);
</del><ins>+ $$ = new TField(type, $1.string, @1);
</ins><span class="cx"> }
</span><span class="cx"> | identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
</span><span class="cx"> if (context->reservedErrorCheck(@1, *$1.string))
</span><span class="cx"> context->recover();
</span><span class="cx">
</span><span class="cx"> TType* type = new TType(EbtVoid, EbpUndefined);
</span><del>- int size = 0;
</del><ins>+ int size;
</ins><span class="cx"> if (context->arraySizeErrorCheck(@3, $3, size))
</span><span class="cx"> context->recover();
</span><span class="cx"> type->setArraySize(size);
</span><span class="cx">
</span><del>- $$ = new TField(type, $1.string);
</del><ins>+ $$ = new TField(type, $1.string, @1);
</ins><span class="cx"> }
</span><span class="cx"> ;
</span><span class="cx">
</span><span class="lines">@@ -1903,7 +1835,7 @@
</span><span class="cx"> : function_prototype {
</span><span class="cx"> TFunction* function = $1.function;
</span><span class="cx">
</span><del>- const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
</del><ins>+ const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
</ins><span class="cx">
</span><span class="cx"> if (builtIn)
</span><span class="cx"> {
</span><span class="lines">@@ -1911,7 +1843,7 @@
</span><span class="cx"> context->recover();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
</del><ins>+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
</ins><span class="cx"> //
</span><span class="cx"> // Note: 'prevDec' could be 'function' if this is the first time we've seen function
</span><span class="cx"> // as it would have just been put in the symbol table. Otherwise, we're looking up
</span><span class="lines">@@ -1962,7 +1894,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->symbolTable.insert(*variable)) {
</del><ins>+ if (! context->symbolTable.declare(*variable)) {
</ins><span class="cx"> context->error(@1, "redefinition", variable->getName().c_str());
</span><span class="cx"> context->recover();
</span><span class="cx"> delete variable;
</span><span class="lines">@@ -1974,9 +1906,8 @@
</span><span class="cx"> paramNodes = context->intermediate.growAggregate(
</span><span class="cx"> paramNodes,
</span><span class="cx"> context->intermediate.addSymbol(variable->getUniqueId(),
</span><del>- variable->getName(),
- variable->getType(),
- @1),
</del><ins>+ variable->getName(),
+ variable->getType(), @1),
</ins><span class="cx"> @1);
</span><span class="cx"> } else {
</span><span class="cx"> paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, @1), @1);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_lexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #line 17 "./glslang.l"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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">@@ -18,7 +18,6 @@
</span><span class="cx"> #pragma warning(disable: 4505)
</span><span class="cx"> #pragma warning(disable: 4701)
</span><span class="cx"> #endif
</span><del>-
</del><span class="cx"> #if defined(__clang__)
</span><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored "-Wunknown-pragmas"
</span><span class="lines">@@ -72,6 +71,7 @@
</span><span class="cx"> typedef uint16_t flex_uint16_t;
</span><span class="cx"> typedef int32_t flex_int32_t;
</span><span class="cx"> typedef uint32_t flex_uint32_t;
</span><ins>+typedef uint64_t flex_uint64_t;
</ins><span class="cx"> #else
</span><span class="cx"> typedef signed char flex_int8_t;
</span><span class="cx"> typedef short int flex_int16_t;
</span><span class="lines">@@ -118,15 +118,15 @@
</span><span class="cx"> /* The "const" storage-class-modifier is valid. */
</span><span class="cx"> #define YY_USE_CONST
</span><span class="cx">
</span><del>-#else /* ! __cplusplus */
</del><ins>+#else        /* ! __cplusplus */
</ins><span class="cx">
</span><span class="cx"> /* C99 requires __STDC__ to be defined as 1. */
</span><span class="cx"> #if defined (__STDC__)
</span><span class="cx">
</span><span class="cx"> #define YY_USE_CONST
</span><span class="cx">
</span><del>-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
</del><ins>+#endif        /* defined (__STDC__) */
+#endif        /* ! __cplusplus */
</ins><span class="cx">
</span><span class="cx"> #ifdef YY_USE_CONST
</span><span class="cx"> #define yyconst const
</span><span class="lines">@@ -201,6 +201,11 @@
</span><span class="cx"> typedef size_t yy_size_t;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
</ins><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><span class="lines">@@ -214,7 +219,7 @@
</span><span class="cx"> */
</span><span class="cx"> #define YY_LESS_LINENO(n) \
</span><span class="cx"> do { \
</span><del>- int yyl;\
</del><ins>+ yy_size_t yyl;\
</ins><span class="cx"> for ( yyl = n; yyl < yyleng; ++yyl )\
</span><span class="cx"> if ( yytext[yyl] == '\n' )\
</span><span class="cx"> --yylineno;\
</span><span class="lines">@@ -222,83 +227,83 @@
</span><span class="cx">
</span><span class="cx"> /* Return all but the first "n" matched characters back to the input stream. */
</span><span class="cx"> #define yyless(n) \
</span><del>- do \
- { \
- /* Undo effects of setting up yytext. */ \
</del><ins>+        do \
+                { \
+                /* Undo effects of setting up yytext. */ \
</ins><span class="cx"> int yyless_macro_arg = (n); \
</span><span class="cx"> YY_LESS_LINENO(yyless_macro_arg);\
</span><del>- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
</del><ins>+                *yy_cp = yyg->yy_hold_char; \
+                YY_RESTORE_YY_MORE_OFFSET \
+                yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+                YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+                } \
+        while ( 0 )
</ins><span class="cx">
</span><span class="cx"> #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
</span><span class="cx">
</span><span class="cx"> #ifndef YY_STRUCT_YY_BUFFER_STATE
</span><span class="cx"> #define YY_STRUCT_YY_BUFFER_STATE
</span><span class="cx"> struct yy_buffer_state
</span><del>- {
- FILE *yy_input_file;
</del><ins>+        {
+        FILE *yy_input_file;
</ins><span class="cx">
</span><del>- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
</del><ins>+        char *yy_ch_buf;                /* input buffer */
+        char *yy_buf_pos;                /* current position in input buffer */
</ins><span class="cx">
</span><del>- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
</del><ins>+        /* Size of input buffer in bytes, not including room for EOB
+         * characters.
+         */
+        yy_size_t yy_buf_size;
</ins><span class="cx">
</span><del>- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- yy_size_t yy_n_chars;
</del><ins>+        /* Number of characters read into yy_ch_buf, not including EOB
+         * characters.
+         */
+        yy_size_t yy_n_chars;
</ins><span class="cx">
</span><del>- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
</del><ins>+        /* Whether we "own" the buffer - i.e., we know we created it,
+         * and can realloc() it to grow it, and should free() it to
+         * delete it.
+         */
+        int yy_is_our_buffer;
</ins><span class="cx">
</span><del>- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
</del><ins>+        /* Whether this is an "interactive" input source; if so, and
+         * if we're using stdio for input, then we want to use getc()
+         * instead of fread(), to make sure we stop fetching input after
+         * each newline.
+         */
+        int yy_is_interactive;
</ins><span class="cx">
</span><del>- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
</del><ins>+        /* Whether we're considered to be at the beginning of a line.
+         * If so, '^' rules will be active on the next match, otherwise
+         * not.
+         */
+        int yy_at_bol;
</ins><span class="cx">
</span><span class="cx"> int yy_bs_lineno; /**< The line count. */
</span><span class="cx"> int yy_bs_column; /**< The column count. */
</span><span class="cx">
</span><del>- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
</del><ins>+        /* Whether to try to fill the input buffer when we reach the
+         * end of it.
+         */
+        int yy_fill_buffer;
</ins><span class="cx">
</span><del>- int yy_buffer_status;
</del><ins>+        int yy_buffer_status;
</ins><span class="cx">
</span><span class="cx"> #define YY_BUFFER_NEW 0
</span><span class="cx"> #define YY_BUFFER_NORMAL 1
</span><del>- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
</del><ins>+        /* When an EOF's been seen but there's still some text to process
+         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+         * shouldn't try reading from the input source any more. We might
+         * still have a bunch of tokens to match, though, because of
+         * possible backing-up.
+         *
+         * When we actually see the EOF, we change the status to "new"
+         * (via yyrestart()), so that the user can continue scanning by
+         * just pointing yyin at a new input file.
+         */
</ins><span class="cx"> #define YY_BUFFER_EOF_PENDING 2
</span><span class="cx">
</span><del>- };
</del><ins>+        };
</ins><span class="cx"> #endif /* !YY_STRUCT_YY_BUFFER_STATE */
</span><span class="cx">
</span><span class="cx"> /* We provide macros for accessing buffer states in case in the
</span><span class="lines">@@ -341,24 +346,24 @@
</span><span class="cx"> #define yy_new_buffer yy_create_buffer
</span><span class="cx">
</span><span class="cx"> #define yy_set_interactive(is_interactive) \
</span><del>- { \
- if ( ! YY_CURRENT_BUFFER ){ \
</del><ins>+        { \
+        if ( ! YY_CURRENT_BUFFER ){ \
</ins><span class="cx"> yyensure_buffer_stack (yyscanner); \
</span><del>- YY_CURRENT_BUFFER_LVALUE = \
</del><ins>+                YY_CURRENT_BUFFER_LVALUE = \
</ins><span class="cx"> yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
</span><del>- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
</del><ins>+        } \
+        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+        }
</ins><span class="cx">
</span><span class="cx"> #define yy_set_bol(at_bol) \
</span><del>- { \
- if ( ! YY_CURRENT_BUFFER ){\
</del><ins>+        { \
+        if ( ! YY_CURRENT_BUFFER ){\
</ins><span class="cx"> yyensure_buffer_stack (yyscanner); \
</span><del>- YY_CURRENT_BUFFER_LVALUE = \
</del><ins>+                YY_CURRENT_BUFFER_LVALUE = \
</ins><span class="cx"> yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
</span><del>- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
</del><ins>+        } \
+        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+        }
</ins><span class="cx">
</span><span class="cx"> #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
</span><span class="cx">
</span><span class="lines">@@ -382,72 +387,113 @@
</span><span class="cx"> * corresponding action - sets up yytext.
</span><span class="cx"> */
</span><span class="cx"> #define YY_DO_BEFORE_ACTION \
</span><del>- yyg->yytext_ptr = yy_bp; \
- yyleng = (size_t) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yyg->yy_c_buf_p = yy_cp;
</del><ins>+        yyg->yytext_ptr = yy_bp; \
+        yyleng = (yy_size_t) (yy_cp - yy_bp); \
+        yyg->yy_hold_char = *yy_cp; \
+        *yy_cp = '\0'; \
+        yyg->yy_c_buf_p = yy_cp;
</ins><span class="cx">
</span><del>-#define YY_NUM_RULES 147
-#define YY_END_OF_BUFFER 148
</del><ins>+#define YY_NUM_RULES 237
+#define YY_END_OF_BUFFER 238
</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><del>- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static yyconst flex_int16_t yy_accept[443] =
</del><ins>+        {
+        flex_int32_t yy_verify;
+        flex_int32_t yy_nxt;
+        };
+static yyconst flex_int16_t yy_accept[813] =
</ins><span class="cx"> { 0,
</span><del>- 0, 0, 148, 146, 145, 145, 132, 138, 143, 127,
- 128, 136, 135, 124, 133, 131, 137, 96, 96, 125,
- 121, 139, 126, 140, 144, 93, 129, 130, 142, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 122,
- 141, 123, 134, 118, 104, 123, 112, 107, 102, 110,
- 100, 111, 101, 99, 103, 98, 95, 96, 0, 0,
- 130, 122, 129, 119, 115, 117, 116, 120, 93, 108,
- 114, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 12, 93, 93, 93, 93, 93, 93, 93, 93,
</del><ins>+ 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,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 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,
</ins><span class="cx">
</span><del>- 93, 93, 93, 93, 93, 15, 17, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 109, 113, 0, 98, 0, 0,
- 97, 94, 105, 106, 45, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 13, 93, 93, 93, 93, 93, 93,
- 93, 93, 21, 93, 93, 93, 93, 93, 93, 93,
- 93, 18, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
</del><ins>+ 177, 177, 177, 177, 177, 177, 177, 177, 15, 177,
+ 177, 23, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 199, 203, 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, 27, 177, 177, 177, 177, 177,
</ins><span class="cx">
</span><del>- 93, 93, 93, 93, 93, 0, 99, 0, 98, 93,
- 23, 93, 93, 90, 93, 93, 93, 93, 93, 93,
- 93, 16, 48, 93, 93, 93, 64, 93, 93, 53,
- 68, 93, 93, 93, 93, 93, 93, 93, 93, 65,
- 4, 28, 29, 30, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
- 51, 24, 93, 93, 93, 93, 93, 93, 31, 32,
- 33, 22, 93, 93, 93, 10, 37, 38, 39, 46,
- 7, 93, 93, 93, 93, 77, 78, 79, 93, 25,
- 69, 20, 80, 81, 82, 2, 74, 75, 76, 93,
</del><ins>+ 177, 177, 177, 177, 177, 177, 24, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 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, 177, 177, 177, 177, 177, 177,
</ins><span class="cx">
</span><del>- 19, 72, 93, 93, 34, 35, 36, 93, 93, 93,
- 93, 93, 93, 93, 93, 93, 66, 93, 93, 93,
- 93, 93, 93, 93, 93, 47, 93, 92, 93, 93,
- 14, 93, 93, 93, 93, 67, 61, 56, 93, 93,
- 93, 93, 93, 73, 52, 93, 59, 27, 93, 89,
- 60, 44, 71, 54, 93, 93, 93, 93, 93, 93,
- 93, 93, 55, 26, 93, 93, 93, 3, 93, 93,
- 93, 93, 93, 49, 8, 93, 9, 93, 93, 11,
- 62, 93, 93, 93, 57, 93, 93, 93, 93, 93,
- 93, 50, 70, 58, 6, 63, 1, 91, 5, 83,
</del><ins>+ 177, 177, 177, 177, 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, 177, 177, 177, 153, 177, 177,
</ins><span class="cx">
</span><del>- 40, 84, 93, 93, 93, 93, 93, 93, 93, 93,
- 93, 93, 93, 93, 41, 93, 93, 93, 93, 93,
- 93, 93, 43, 93, 87, 93, 93, 93, 93, 93,
- 85, 93, 86, 93, 93, 93, 93, 93, 93, 42,
- 88, 0
</del><ins>+ 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,
+
+ 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, 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,
+
+ 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">@@ -458,14 +504,14 @@
</span><span class="cx"> 1, 2, 4, 1, 1, 1, 5, 6, 1, 7,
</span><span class="cx"> 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
</span><span class="cx"> 18, 19, 20, 20, 20, 21, 21, 22, 23, 24,
</span><del>- 25, 26, 27, 1, 28, 28, 29, 30, 31, 28,
- 32, 32, 32, 32, 32, 32, 32, 32, 33, 32,
- 32, 34, 35, 32, 32, 32, 32, 36, 32, 32,
- 37, 1, 38, 39, 32, 1, 40, 41, 42, 43,
</del><ins>+ 25, 26, 27, 1, 28, 29, 30, 31, 32, 33,
+ 34, 34, 34, 34, 34, 34, 35, 34, 36, 34,
+ 34, 37, 38, 34, 39, 34, 34, 40, 34, 34,
+ 41, 1, 42, 43, 44, 1, 45, 46, 47, 48,
</ins><span class="cx">
</span><del>- 44, 45, 46, 47, 48, 32, 49, 50, 51, 52,
- 53, 54, 32, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 1, 1, 1, 1,
</del><ins>+ 49, 50, 51, 52, 53, 34, 54, 55, 56, 57,
+ 58, 59, 34, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 1, 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, 1, 1, 1, 1, 1, 1,
</span><span class="cx"> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
</span><span class="lines">@@ -482,200 +528,323 @@
</span><span class="cx"> 1, 1, 1, 1, 1
</span><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int32_t yy_meta[68] =
</del><ins>+static yyconst flex_int32_t yy_meta[73] =
</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, 2, 2, 2, 2, 2, 2,
</span><del>- 2, 1, 1, 1, 1, 1, 1, 2, 2, 2,
- 2, 3, 3, 3, 3, 3, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 1, 1, 1, 1
</del><ins>+ 2, 1, 1, 1, 1, 1, 1, 3, 3, 3,
+ 3, 2, 2, 4, 4, 4, 4, 4, 4, 4,
+ 1, 1, 1, 4, 3, 3, 3, 3, 2, 2,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
+ 1, 1
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_base[445] =
</del><ins>+static yyconst flex_int16_t yy_base[817] =
</ins><span class="cx"> { 0,
</span><del>- 0, 0, 587, 588, 588, 588, 561, 43, 64, 588,
- 588, 560, 61, 588, 60, 58, 559, 77, 86, 557,
- 588, 104, 557, 55, 588, 0, 588, 588, 75, 26,
- 57, 82, 83, 73, 93, 528, 97, 95, 527, 44,
- 71, 521, 104, 534, 110, 116, 35, 111, 530, 588,
- 114, 588, 588, 588, 588, 588, 588, 588, 588, 588,
- 588, 588, 588, 165, 588, 172, 202, 211, 233, 0,
- 588, 588, 588, 551, 588, 588, 588, 550, 0, 588,
- 588, 523, 516, 519, 527, 526, 513, 528, 515, 521,
- 509, 506, 519, 506, 503, 503, 509, 497, 108, 502,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 512, 498, 504, 507, 508, 0, 145, 507, 113, 493,
- 506, 497, 499, 489, 503, 500, 502, 485, 490, 487,
- 476, 157, 484, 489, 485, 487, 476, 479, 118, 484,
- 476, 488, 70, 481, 588, 588, 246, 253, 270, 219,
- 283, 0, 588, 588, 0, 473, 477, 486, 483, 467,
- 467, 119, 482, 479, 479, 477, 474, 466, 472, 459,
- 470, 456, 472, 0, 469, 457, 464, 461, 465, 458,
- 447, 446, 459, 462, 459, 454, 445, 188, 450, 453,
- 444, 441, 445, 451, 442, 433, 436, 434, 444, 430,
- 428, 441, 427, 429, 426, 437, 436, 124, 431, 426,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 415, 258, 433, 435, 424, 290, 297, 304, 311, 425,
- 0, 423, 275, 0, 415, 413, 421, 410, 427, 416,
- 316, 0, 0, 410, 420, 420, 0, 405, 319, 0,
- 0, 407, 322, 408, 402, 401, 402, 401, 325, 0,
- 0, 0, 0, 0, 397, 398, 403, 394, 407, 402,
- 401, 393, 397, 389, 392, 396, 401, 387, 399, 390,
- 0, 0, 396, 385, 385, 390, 389, 386, 0, 0,
- 0, 0, 376, 388, 390, 0, 0, 0, 0, 0,
- 0, 378, 379, 373, 383, 0, 0, 0, 374, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 381,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 0, 0, 379, 375, 0, 0, 0, 371, 367, 372,
- 362, 375, 361, 374, 363, 370, 0, 368, 370, 354,
- 356, 362, 368, 363, 351, 0, 353, 0, 352, 355,
- 0, 344, 343, 343, 356, 0, 358, 0, 357, 356,
- 341, 354, 341, 0, 0, 344, 0, 0, 336, 0,
- 0, 0, 0, 0, 333, 344, 337, 343, 340, 335,
- 327, 339, 0, 0, 332, 339, 328, 0, 337, 334,
- 324, 329, 332, 0, 0, 332, 0, 330, 329, 0,
- 0, 328, 314, 326, 0, 317, 338, 337, 336, 307,
- 303, 0, 0, 0, 0, 0, 0, 0, 0, 328,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 166, 325, 316, 299, 308, 310, 306, 308, 307, 306,
- 309, 306, 256, 253, 0, 228, 238, 222, 235, 203,
- 207, 204, 212, 191, 0, 201, 165, 167, 153, 161,
- 0, 170, 0, 175, 151, 141, 100, 114, 59, 0,
- 0, 588, 359, 113
</del><ins>+ 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,
+
+ 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,
+
+ 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,
+
+ 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,
+
+ 0, 0, 373, 374, 368, 0, 369, 370, 0, 0,
+ 0, 942, 434, 437, 438, 439
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_def[445] =
</del><ins>+static yyconst flex_int16_t yy_def[817] =
</ins><span class="cx"> { 0,
</span><del>- 442, 1, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 443, 442, 442, 442, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 444,
- 442, 442, 442, 442, 442, 442, 442, 442, 443, 442,
- 442, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 442, 442, 442, 442, 442, 442,
- 442, 444, 442, 442, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
</del><ins>+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 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,
</ins><span class="cx">
</span><del>- 443, 443, 443, 443, 443, 442, 442, 442, 442, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
</del><ins>+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 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,
</ins><span class="cx">
</span><del>- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
</del><ins>+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
</ins><span class="cx">
</span><del>- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 443, 0, 442, 442
</del><ins>+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+
+ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ 813, 0, 812, 812, 812, 812
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_nxt[656] =
</del><ins>+static yyconst flex_int16_t yy_nxt[1015] =
</ins><span class="cx"> { 0,
</span><span class="cx"> 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
</span><span class="cx"> 14, 15, 16, 17, 18, 19, 19, 19, 19, 19,
</span><span class="cx"> 19, 20, 21, 22, 23, 24, 25, 26, 26, 26,
</span><del>- 26, 26, 26, 26, 26, 26, 27, 28, 29, 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, 77,
- 78, 82, 83, 110, 63, 61, 129, 111, 58, 66,
- 130, 67, 67, 67, 67, 67, 67, 68, 66, 80,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 68, 68, 68, 68, 68, 68, 68, 69, 72, 84,
- 112, 85, 70, 81, 142, 86, 69, 203, 441, 204,
- 69, 87, 94, 113, 95, 73, 90, 74, 75, 69,
- 91, 88, 97, 96, 89, 92, 103, 70, 135, 106,
- 98, 93, 99, 115, 104, 100, 107, 162, 440, 119,
- 131, 101, 439, 108, 132, 105, 120, 121, 116, 125,
- 163, 117, 126, 133, 176, 198, 122, 123, 264, 124,
- 127, 438, 177, 199, 216, 217, 265, 128, 136, 64,
- 64, 64, 64, 64, 64, 64, 138, 138, 138, 138,
- 138, 138, 138, 437, 170, 137, 190, 171, 172, 406,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 407, 173, 139, 174, 242, 243, 244, 436, 137, 435,
- 434, 191, 433, 432, 66, 139, 67, 67, 67, 67,
- 67, 67, 68, 66, 431, 68, 68, 68, 68, 68,
- 68, 68, 69, 141, 141, 141, 141, 141, 141, 141,
- 430, 69, 140, 429, 140, 69, 428, 141, 141, 141,
- 141, 141, 141, 141, 69, 206, 427, 206, 426, 425,
- 207, 207, 207, 207, 207, 207, 207, 138, 138, 138,
- 138, 138, 138, 138, 269, 270, 271, 424, 423, 208,
- 422, 208, 421, 139, 209, 209, 209, 209, 209, 209,
- 209, 277, 278, 279, 420, 419, 139, 141, 141, 141,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 141, 141, 141, 141, 207, 207, 207, 207, 207, 207,
- 207, 207, 207, 207, 207, 207, 207, 207, 209, 209,
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 286, 287, 288, 293, 294, 295, 297, 298,
- 299, 305, 306, 307, 387, 388, 389, 418, 417, 416,
- 415, 414, 413, 412, 411, 410, 409, 390, 408, 391,
- 79, 79, 405, 404, 403, 402, 401, 400, 399, 398,
- 397, 396, 395, 394, 393, 392, 386, 385, 384, 383,
- 382, 381, 380, 379, 378, 377, 376, 375, 374, 373,
- 372, 371, 370, 369, 368, 367, 366, 365, 364, 363,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 362, 361, 360, 359, 358, 357, 356, 355, 354, 353,
- 352, 351, 350, 349, 348, 347, 346, 345, 344, 343,
- 342, 341, 340, 339, 338, 337, 336, 335, 334, 333,
- 332, 331, 330, 329, 328, 327, 326, 325, 324, 323,
- 322, 321, 320, 319, 318, 317, 316, 315, 314, 313,
- 312, 311, 310, 309, 308, 304, 303, 302, 301, 300,
- 296, 292, 291, 290, 289, 285, 284, 283, 282, 281,
- 280, 276, 275, 274, 273, 272, 268, 267, 266, 263,
- 262, 261, 260, 259, 258, 257, 256, 255, 254, 253,
- 252, 251, 250, 249, 248, 247, 246, 245, 241, 240,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 239, 238, 237, 236, 235, 234, 233, 232, 231, 230,
- 229, 228, 227, 226, 225, 224, 223, 222, 221, 220,
- 219, 218, 215, 214, 213, 212, 211, 210, 205, 202,
- 201, 200, 197, 196, 195, 194, 193, 192, 189, 188,
- 187, 186, 185, 184, 183, 182, 181, 180, 179, 178,
- 175, 169, 168, 167, 166, 165, 164, 161, 160, 159,
- 158, 157, 156, 155, 154, 153, 152, 151, 150, 149,
- 148, 147, 146, 145, 144, 143, 134, 118, 114, 109,
- 102, 76, 71, 65, 59, 54, 442, 3, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442
</del><ins>+ 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,
+
+ 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,
+
+ 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,
+
+ 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,
+
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812
</ins><span class="cx"> } ;
</span><span class="cx">
</span><del>-static yyconst flex_int16_t yy_chk[656] =
</del><ins>+static yyconst flex_int16_t yy_chk[1015] =
</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">@@ -683,76 +852,116 @@
</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, 1, 1, 1, 1, 1, 8, 8, 9,
- 13, 15, 16, 16, 16, 16, 16, 16, 16, 24,
- 24, 30, 30, 40, 15, 13, 47, 40, 9, 18,
- 47, 18, 18, 18, 18, 18, 18, 18, 19, 29,
</del><ins>+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 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,
</ins><span class="cx">
</span><del>- 19, 19, 19, 19, 19, 19, 19, 18, 22, 31,
- 41, 31, 18, 29, 444, 31, 19, 133, 439, 133,
- 18, 32, 34, 41, 34, 22, 33, 22, 22, 19,
- 33, 32, 35, 34, 32, 33, 37, 18, 51, 38,
- 35, 33, 35, 43, 37, 35, 38, 99, 438, 45,
- 48, 35, 437, 38, 48, 37, 45, 45, 43, 46,
- 99, 43, 46, 48, 109, 129, 45, 45, 198, 45,
- 46, 436, 109, 129, 152, 152, 198, 46, 51, 64,
- 64, 64, 64, 64, 64, 64, 66, 66, 66, 66,
- 66, 66, 66, 435, 107, 64, 122, 107, 107, 401,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 401, 107, 66, 107, 178, 178, 178, 434, 64, 432,
- 430, 122, 429, 428, 67, 66, 67, 67, 67, 67,
- 67, 67, 67, 68, 427, 68, 68, 68, 68, 68,
- 68, 68, 67, 140, 140, 140, 140, 140, 140, 140,
- 426, 68, 69, 424, 69, 67, 423, 69, 69, 69,
- 69, 69, 69, 69, 68, 137, 422, 137, 421, 420,
- 137, 137, 137, 137, 137, 137, 137, 138, 138, 138,
- 138, 138, 138, 138, 202, 202, 202, 419, 418, 139,
- 417, 139, 416, 138, 139, 139, 139, 139, 139, 139,
- 139, 213, 213, 213, 414, 413, 138, 141, 141, 141,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 141, 141, 141, 141, 206, 206, 206, 206, 206, 206,
- 206, 207, 207, 207, 207, 207, 207, 207, 208, 208,
- 208, 208, 208, 208, 208, 209, 209, 209, 209, 209,
- 209, 209, 221, 221, 221, 229, 229, 229, 233, 233,
- 233, 239, 239, 239, 372, 372, 372, 412, 411, 410,
- 409, 408, 407, 406, 405, 404, 403, 372, 402, 372,
- 443, 443, 400, 391, 390, 389, 388, 387, 386, 384,
- 383, 382, 379, 378, 376, 373, 371, 370, 369, 367,
- 366, 365, 362, 361, 360, 359, 358, 357, 356, 355,
- 349, 346, 343, 342, 341, 340, 339, 337, 335, 334,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 333, 332, 330, 329, 327, 325, 324, 323, 322, 321,
- 320, 319, 318, 316, 315, 314, 313, 312, 311, 310,
- 309, 308, 304, 303, 300, 289, 285, 284, 283, 282,
- 275, 274, 273, 268, 267, 266, 265, 264, 263, 260,
- 259, 258, 257, 256, 255, 254, 253, 252, 251, 250,
- 249, 248, 247, 246, 245, 238, 237, 236, 235, 234,
- 232, 228, 226, 225, 224, 220, 219, 218, 217, 216,
- 215, 212, 210, 205, 204, 203, 201, 200, 199, 197,
- 196, 195, 194, 193, 192, 191, 190, 189, 188, 187,
- 186, 185, 184, 183, 182, 181, 180, 179, 177, 176,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 175, 174, 173, 172, 171, 170, 169, 168, 167, 166,
- 165, 163, 162, 161, 160, 159, 158, 157, 156, 155,
- 154, 153, 151, 150, 149, 148, 147, 146, 134, 132,
- 131, 130, 128, 127, 126, 125, 124, 123, 121, 120,
- 119, 118, 117, 116, 115, 114, 113, 112, 111, 110,
- 108, 105, 104, 103, 102, 101, 100, 98, 97, 96,
- 95, 94, 93, 92, 91, 90, 89, 88, 87, 86,
- 85, 84, 83, 82, 78, 74, 49, 44, 42, 39,
- 36, 23, 20, 17, 12, 7, 3, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
</del><ins>+ 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,
</ins><span class="cx">
</span><del>- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442, 442, 442, 442, 442, 442,
- 442, 442, 442, 442, 442
</del><ins>+ 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,
+
+ 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,
+
+ 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,
+
+ 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,
+
+ 812, 812, 812, 812, 812, 812, 812, 812, 812, 812,
+ 812, 812, 812, 812
</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[148] =
</del><ins>+static yyconst flex_int32_t yy_rule_can_match_eol[238] =
</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">@@ -761,7 +970,11 @@
</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, 1, 0, 0, };
</del><ins>+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, };
</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">@@ -772,7 +985,7 @@
</span><span class="cx"> #define YY_RESTORE_YY_MORE_OFFSET
</span><span class="cx"> /*
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -789,7 +1002,8 @@
</span><span class="cx"> #include "compiler/translator/ParseContext.h"
</span><span class="cx"> #include "compiler/preprocessor/Token.h"
</span><span class="cx"> #include "compiler/translator/util.h"
</span><del>-#include "compiler/translator/glslang_tab.h"
</del><ins>+#include "compiler/translator/length_limits.h"
+#include "glslang_tab.h"
</ins><span class="cx">
</span><span class="cx"> /* windows only pragma */
</span><span class="cx"> #ifdef _MSC_VER
</span><span class="lines">@@ -806,8 +1020,13 @@
</span><span class="cx"> static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
</span><span class="cx"> static int check_type(yyscan_t yyscanner);
</span><span class="cx"> static int reserved_word(yyscan_t yyscanner);
</span><ins>+static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
+static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
+static int ES2_ident_ES3_keyword(TParseContext *context, int token);
+static int uint_constant(TParseContext *context);
</ins><span class="cx"> static int int_constant(yyscan_t yyscanner);
</span><span class="cx"> static int float_constant(yyscan_t yyscanner);
</span><ins>+static int floatsuffix_check(TParseContext* context);
</ins><span class="cx">
</span><span class="cx"> #define INITIAL 0
</span><span class="cx">
</span><span class="lines">@@ -952,33 +1171,33 @@
</span><span class="cx"> */
</span><span class="cx"> #ifndef YY_INPUT
</span><span class="cx"> #define YY_INPUT(buf,result,max_size) \
</span><del>- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- size_t n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
</del><ins>+        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+                { \
+                int c = '*'; \
+                size_t n; \
+                for ( n = 0; n < max_size && \
+                         (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+                        buf[n] = (char) c; \
+                if ( c == '\n' ) \
+                        buf[n++] = (char) c; \
+                if ( c == EOF && ferror( yyin ) ) \
+                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
+                result = n; \
+                } \
+        else \
+                { \
+                errno=0; \
+                while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+                        { \
+                        if( errno != EINTR) \
+                                { \
+                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
+                                break; \
+                                } \
+                        errno=0; \
+                        clearerr(yyin); \
+                        } \
+                }\
</ins><span class="cx"> \
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="lines">@@ -1029,1034 +1248,1128 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #define YY_RULE_SETUP \
</span><del>- YY_USER_ACTION
</del><ins>+        YY_USER_ACTION
</ins><span class="cx">
</span><span class="cx"> /** The main scanner function which does all the work.
</span><span class="cx"> */
</span><span class="cx"> YY_DECL
</span><span class="cx"> {
</span><del>- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
</del><ins>+        register yy_state_type yy_current_state;
+        register char *yy_cp, *yy_bp;
+        register int yy_act;
</ins><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><ins>+ TParseContext* context = yyextra;
+
</ins><span class="cx"> yylval = yylval_param;
</span><span class="cx">
</span><span class="cx"> yylloc = yylloc_param;
</span><span class="cx">
</span><del>- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
</del><ins>+        if ( !yyg->yy_init )
+                {
+                yyg->yy_init = 1;
</ins><span class="cx">
</span><span class="cx"> #ifdef YY_USER_INIT
</span><del>- YY_USER_INIT;
</del><ins>+                YY_USER_INIT;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
</del><ins>+                if ( ! yyg->yy_start )
+                        yyg->yy_start = 1;        /* first start state */
</ins><span class="cx">
</span><del>- if ( ! yyin )
- yyin = stdin;
</del><ins>+                if ( ! yyin )
+                        yyin = stdin;
</ins><span class="cx">
</span><del>- if ( ! yyout )
- yyout = stdout;
</del><ins>+                if ( ! yyout )
+                        yyout = stdout;
</ins><span class="cx">
</span><del>- if ( ! YY_CURRENT_BUFFER ) {
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
- }
</del><ins>+                if ( ! YY_CURRENT_BUFFER ) {
+                        yyensure_buffer_stack (yyscanner);
+                        YY_CURRENT_BUFFER_LVALUE =
+                                yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+                }
</ins><span class="cx">
</span><del>- yy_load_buffer_state(yyscanner );
- }
</del><ins>+                yy_load_buffer_state(yyscanner );
+                }
</ins><span class="cx">
</span><del>- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yyg->yy_c_buf_p;
</del><ins>+        while ( 1 )                /* loops until end-of-file is reached */
+                {
+                yy_cp = yyg->yy_c_buf_p;
</ins><span class="cx">
</span><del>- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
</del><ins>+                /* Support of yytext. */
+                *yy_cp = yyg->yy_hold_char;
</ins><span class="cx">
</span><del>- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
</del><ins>+                /* yy_bp points to the position in yy_ch_buf of the start of
+                 * the current run.
+                 */
+                yy_bp = yy_cp;
</ins><span class="cx">
</span><del>- yy_current_state = yyg->yy_start;
</del><ins>+                yy_current_state = yyg->yy_start;
</ins><span class="cx"> yy_match:
</span><del>- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 443 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_current_state != 442 );
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
</del><ins>+                do
+                        {
+                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+                        if ( yy_accept[yy_current_state] )
+                                {
+                                yyg->yy_last_accepting_state = yy_current_state;
+                                yyg->yy_last_accepting_cpos = yy_cp;
+                                }
+                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                                {
+                                yy_current_state = (int) yy_def[yy_current_state];
+                                if ( yy_current_state >= 813 )
+                                        yy_c = yy_meta[(unsigned int) yy_c];
+                                }
+                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+                        ++yy_cp;
+                        }
+                while ( yy_current_state != 812 );
+                yy_cp = yyg->yy_last_accepting_cpos;
+                yy_current_state = yyg->yy_last_accepting_state;
</ins><span class="cx">
</span><span class="cx"> yy_find_action:
</span><del>- yy_act = yy_accept[yy_current_state];
</del><ins>+                yy_act = yy_accept[yy_current_state];
</ins><span class="cx">
</span><del>- YY_DO_BEFORE_ACTION;
</del><ins>+                YY_DO_BEFORE_ACTION;
</ins><span class="cx">
</span><del>- if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
- {
- yy_size_t yyl;
- for ( yyl = 0; yyl < yyleng; ++yyl )
- if ( yytext[yyl] == '\n' )
-
</del><ins>+                if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+                        {
+                        yy_size_t yyl;
+                        for ( yyl = 0; yyl < yyleng; ++yyl )
+                                if ( yytext[yyl] == '\n' )
+                                        
</ins><span class="cx"> do{ yylineno++;
</span><span class="cx"> yycolumn=0;
</span><span class="cx"> }while(0)
</span><span class="cx"> ;
</span><del>- }
</del><ins>+                        }
</ins><span class="cx">
</span><del>-do_action: /* This label is used only to access EOF actions. */
</del><ins>+do_action:        /* This label is used only to access EOF actions. */
</ins><span class="cx">
</span><del>- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
</del><ins>+                switch ( yy_act )
+        { /* beginning of action switch */
+                        case 0: /* must back up */
+                        /* undo the effects of YY_DO_BEFORE_ACTION */
+                        *yy_cp = yyg->yy_hold_char;
+                        yy_cp = yyg->yy_last_accepting_cpos;
+                        yy_current_state = yyg->yy_last_accepting_state;
+                        goto yy_find_action;
</ins><span class="cx">
</span><span class="cx"> case 1:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return INVARIANT; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 2:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return HIGH_PRECISION; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 3:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return MEDIUM_PRECISION; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 4:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LOW_PRECISION; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 5:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return PRECISION; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 6:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return ATTRIBUTE; }
- YY_BREAK
</del><ins>+{ return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
+        YY_BREAK
</ins><span class="cx"> case 7:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return CONST_QUAL; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 8:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return UNIFORM; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 9:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return VARYING; }
- YY_BREAK
</del><ins>+{ return ES2_keyword_ES3_reserved(context, VARYING); }
+        YY_BREAK
</ins><span class="cx"> case 10:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return BREAK; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 11:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return CONTINUE; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 12:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return DO; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 13:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return FOR; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 14:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return WHILE; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 15:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return IF; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 16:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return ELSE; }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case 17:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return IN_QUAL; }
- YY_BREAK
</del><ins>+{ return ES2_reserved_ES3_keyword(context, SWITCH); }
+        YY_BREAK
</ins><span class="cx"> case 18:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return OUT_QUAL; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, CASE); }
+        YY_BREAK
</ins><span class="cx"> case 19:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return INOUT_QUAL; }
- YY_BREAK
</del><ins>+{ return ES2_reserved_ES3_keyword(context, DEFAULT); }
+        YY_BREAK
</ins><span class="cx"> case 20:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return FLOAT_TYPE; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, CENTROID); }
+        YY_BREAK
</ins><span class="cx"> case 21:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return INT_TYPE; }
- YY_BREAK
</del><ins>+{ return ES2_reserved_ES3_keyword(context, FLAT); }
+        YY_BREAK
</ins><span class="cx"> case 22:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return VOID_TYPE; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, SMOOTH); }
+        YY_BREAK
</ins><span class="cx"> case 23:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return BOOL_TYPE; }
- YY_BREAK
</del><ins>+{ return IN_QUAL; }
+        YY_BREAK
</ins><span class="cx"> case 24:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ yylval->lex.b = true; return BOOLCONSTANT; }
- YY_BREAK
</del><ins>+{ return OUT_QUAL; }
+        YY_BREAK
</ins><span class="cx"> case 25:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ yylval->lex.b = false; return BOOLCONSTANT; }
- YY_BREAK
</del><ins>+{ return INOUT_QUAL; }
+        YY_BREAK
</ins><span class="cx"> case 26:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return DISCARD; }
- YY_BREAK
</del><ins>+{ return FLOAT_TYPE; }
+        YY_BREAK
</ins><span class="cx"> case 27:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return RETURN; }
- YY_BREAK
</del><ins>+{ return INT_TYPE; }
+        YY_BREAK
</ins><span class="cx"> case 28:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return MATRIX2; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, UINT_TYPE); }
+        YY_BREAK
</ins><span class="cx"> case 29:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return MATRIX3; }
- YY_BREAK
</del><ins>+{ return VOID_TYPE; }
+        YY_BREAK
</ins><span class="cx"> case 30:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return MATRIX4; }
- YY_BREAK
</del><ins>+{ return BOOL_TYPE; }
+        YY_BREAK
</ins><span class="cx"> case 31:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return VEC2; }
- YY_BREAK
</del><ins>+{ yylval->lex.b = true; return BOOLCONSTANT; }
+        YY_BREAK
</ins><span class="cx"> case 32:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return VEC3; }
- YY_BREAK
</del><ins>+{ yylval->lex.b = false; return BOOLCONSTANT; }
+        YY_BREAK
</ins><span class="cx"> case 33:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return VEC4; }
- YY_BREAK
</del><ins>+{ return DISCARD; }
+        YY_BREAK
</ins><span class="cx"> case 34:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return IVEC2; }
- YY_BREAK
</del><ins>+{ return RETURN; }
+        YY_BREAK
</ins><span class="cx"> case 35:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return IVEC3; }
- YY_BREAK
</del><ins>+{ return MATRIX2; }
+        YY_BREAK
</ins><span class="cx"> case 36:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return IVEC4; }
- YY_BREAK
</del><ins>+{ return MATRIX3; }
+        YY_BREAK
</ins><span class="cx"> case 37:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return BVEC2; }
- YY_BREAK
</del><ins>+{ return MATRIX4; }
+        YY_BREAK
</ins><span class="cx"> case 38:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return BVEC3; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX2); }
+        YY_BREAK
</ins><span class="cx"> case 39:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return BVEC4; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX3); }
+        YY_BREAK
</ins><span class="cx"> case 40:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return SAMPLER2D; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX4); }
+        YY_BREAK
</ins><span class="cx"> case 41:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return SAMPLERCUBE; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX2x3); }
+        YY_BREAK
</ins><span class="cx"> case 42:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return SAMPLER_EXTERNAL_OES; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX3x2); }
+        YY_BREAK
</ins><span class="cx"> case 43:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return SAMPLER2DRECT; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX2x4); }
+        YY_BREAK
</ins><span class="cx"> case 44:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return STRUCT; }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX4x2); }
+        YY_BREAK
</ins><span class="cx"> case 45:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX3x4); }
+        YY_BREAK
</ins><span class="cx"> case 46:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, MATRIX4x3); }
+        YY_BREAK
</ins><span class="cx"> case 47:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return VEC2; }
+        YY_BREAK
</ins><span class="cx"> case 48:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return VEC3; }
+        YY_BREAK
</ins><span class="cx"> case 49:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return VEC4; }
+        YY_BREAK
</ins><span class="cx"> case 50:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return IVEC2; }
+        YY_BREAK
</ins><span class="cx"> case 51:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return IVEC3; }
+        YY_BREAK
</ins><span class="cx"> case 52:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return IVEC4; }
+        YY_BREAK
</ins><span class="cx"> case 53:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return BVEC2; }
+        YY_BREAK
</ins><span class="cx"> case 54:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return BVEC3; }
+        YY_BREAK
</ins><span class="cx"> case 55:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return BVEC4; }
+        YY_BREAK
</ins><span class="cx"> case 56:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, UVEC2); }
+        YY_BREAK
</ins><span class="cx"> case 57:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, UVEC3); }
+        YY_BREAK
</ins><span class="cx"> case 58:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, UVEC4); }
+        YY_BREAK
</ins><span class="cx"> case 59:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return SAMPLER2D; }
+        YY_BREAK
</ins><span class="cx"> case 60:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return SAMPLERCUBE; }
+        YY_BREAK
</ins><span class="cx"> case 61:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return SAMPLER_EXTERNAL_OES; }
+        YY_BREAK
</ins><span class="cx"> case 62:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_reserved_ES3_keyword(context, SAMPLER3D); }
+        YY_BREAK
</ins><span class="cx"> case 63:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
+        YY_BREAK
</ins><span class="cx"> case 64:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return SAMPLER2DRECT; }
+        YY_BREAK
</ins><span class="cx"> case 65:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
+        YY_BREAK
</ins><span class="cx"> case 66:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, ISAMPLER2D); }
+        YY_BREAK
</ins><span class="cx"> case 67:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, ISAMPLER3D); }
+        YY_BREAK
</ins><span class="cx"> case 68:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); }
+        YY_BREAK
</ins><span class="cx"> case 69:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); }
+        YY_BREAK
</ins><span class="cx"> case 70:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, USAMPLER2D); }
+        YY_BREAK
</ins><span class="cx"> case 71:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, USAMPLER3D); }
+        YY_BREAK
</ins><span class="cx"> case 72:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, USAMPLERCUBE); }
+        YY_BREAK
</ins><span class="cx"> case 73:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); }
+        YY_BREAK
</ins><span class="cx"> case 74:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
+        YY_BREAK
</ins><span class="cx"> case 75:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); }
+        YY_BREAK
</ins><span class="cx"> case 76:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
+        YY_BREAK
</ins><span class="cx"> case 77:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return STRUCT; }
+        YY_BREAK
</ins><span class="cx"> case 78:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><ins>+{ return ES2_ident_ES3_keyword(context, LAYOUT); }
+        YY_BREAK
+/* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
</ins><span class="cx"> case 79:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 80:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 81:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 82:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 83:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 84:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 85:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 86:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 87:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 88:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 89:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 90:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 91:
</span><del>-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
</del><span class="cx"> case 92:
</span><ins>+case 93:
+case 94:
+case 95:
+case 96:
+case 97:
+case 98:
+case 99:
+case 100:
+case 101:
+case 102:
+case 103:
+case 104:
+case 105:
+case 106:
+case 107:
+case 108:
+case 109:
+case 110:
+case 111:
+case 112:
+case 113:
+case 114:
+case 115:
+case 116:
+case 117:
+case 118:
+case 119:
+case 120:
+case 121:
+case 122:
+case 123:
+case 124:
+case 125:
+case 126:
+case 127:
+case 128:
+case 129:
+case 130:
+case 131:
+case 132:
+case 133:
+case 134:
</ins><span class="cx"> YY_RULE_SETUP
</span><ins>+{
+ if (context->shaderVersion < 300) {
+                yylval->lex.string = NewPoolTString(yytext);
+         return check_type(yyscanner);
+        }
+        return reserved_word(yyscanner);
+}
+        YY_BREAK
+/* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
+case 135:
+YY_RULE_SETUP
+{
+ if (context->shaderVersion >= 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+
+ return reserved_word(yyscanner);
+}
+        YY_BREAK
+/* Reserved keywords */
+case 136:
+case 137:
+case 138:
+case 139:
+case 140:
+case 141:
+case 142:
+case 143:
+case 144:
+case 145:
+case 146:
+case 147:
+case 148:
+case 149:
+case 150:
+case 151:
+case 152:
+case 153:
+case 154:
+case 155:
+case 156:
+case 157:
+case 158:
+case 159:
+case 160:
+case 161:
+case 162:
+case 163:
+case 164:
+case 165:
+case 166:
+case 167:
+case 168:
+case 169:
+case 170:
+case 171:
+case 172:
+case 173:
+case 174:
+case 175:
+case 176:
+YY_RULE_SETUP
</ins><span class="cx"> { return reserved_word(yyscanner); }
</span><del>- YY_BREAK
-case 93:
</del><ins>+        YY_BREAK
+case 177:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> {
</span><span class="cx"> yylval->lex.string = NewPoolTString(yytext);
</span><span class="cx"> return check_type(yyscanner);
</span><span class="cx"> }
</span><del>- YY_BREAK
-case 94:
</del><ins>+        YY_BREAK
+case 178:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return int_constant(yyscanner); }
</span><del>- YY_BREAK
-case 95:
</del><ins>+        YY_BREAK
+case 179:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return int_constant(yyscanner); }
</span><del>- YY_BREAK
-case 96:
</del><ins>+        YY_BREAK
+case 180:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return int_constant(yyscanner); }
</span><del>- YY_BREAK
-case 97:
</del><ins>+        YY_BREAK
+case 181:
</ins><span class="cx"> YY_RULE_SETUP
</span><ins>+{ return uint_constant(context); }
+        YY_BREAK
+case 182:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+        YY_BREAK
+case 183:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+        YY_BREAK
+case 184:
+YY_RULE_SETUP
</ins><span class="cx"> { return float_constant(yyscanner); }
</span><del>- YY_BREAK
-case 98:
</del><ins>+        YY_BREAK
+case 185:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return float_constant(yyscanner); }
</span><del>- YY_BREAK
-case 99:
</del><ins>+        YY_BREAK
+case 186:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return float_constant(yyscanner); }
</span><del>- YY_BREAK
-case 100:
</del><ins>+        YY_BREAK
+case 187:
</ins><span class="cx"> YY_RULE_SETUP
</span><ins>+{ return floatsuffix_check(context); }
+        YY_BREAK
+case 188:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+        YY_BREAK
+case 189:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+        YY_BREAK
+case 190:
+YY_RULE_SETUP
</ins><span class="cx"> { return ADD_ASSIGN; }
</span><del>- YY_BREAK
-case 101:
</del><ins>+        YY_BREAK
+case 191:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return SUB_ASSIGN; }
</span><del>- YY_BREAK
-case 102:
</del><ins>+        YY_BREAK
+case 192:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return MUL_ASSIGN; }
</span><del>- YY_BREAK
-case 103:
</del><ins>+        YY_BREAK
+case 193:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return DIV_ASSIGN; }
</span><del>- YY_BREAK
-case 104:
</del><ins>+        YY_BREAK
+case 194:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return MOD_ASSIGN; }
</span><del>- YY_BREAK
-case 105:
</del><ins>+        YY_BREAK
+case 195:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LEFT_ASSIGN; }
</span><del>- YY_BREAK
-case 106:
</del><ins>+        YY_BREAK
+case 196:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return RIGHT_ASSIGN; }
</span><del>- YY_BREAK
-case 107:
</del><ins>+        YY_BREAK
+case 197:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return AND_ASSIGN; }
</span><del>- YY_BREAK
-case 108:
</del><ins>+        YY_BREAK
+case 198:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return XOR_ASSIGN; }
</span><del>- YY_BREAK
-case 109:
</del><ins>+        YY_BREAK
+case 199:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return OR_ASSIGN; }
</span><del>- YY_BREAK
-case 110:
</del><ins>+        YY_BREAK
+case 200:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return INC_OP; }
</span><del>- YY_BREAK
-case 111:
</del><ins>+        YY_BREAK
+case 201:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return DEC_OP; }
</span><del>- YY_BREAK
-case 112:
</del><ins>+        YY_BREAK
+case 202:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return AND_OP; }
</span><del>- YY_BREAK
-case 113:
</del><ins>+        YY_BREAK
+case 203:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return OR_OP; }
</span><del>- YY_BREAK
-case 114:
</del><ins>+        YY_BREAK
+case 204:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return XOR_OP; }
</span><del>- YY_BREAK
-case 115:
</del><ins>+        YY_BREAK
+case 205:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LE_OP; }
</span><del>- YY_BREAK
-case 116:
</del><ins>+        YY_BREAK
+case 206:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return GE_OP; }
</span><del>- YY_BREAK
-case 117:
</del><ins>+        YY_BREAK
+case 207:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return EQ_OP; }
</span><del>- YY_BREAK
-case 118:
</del><ins>+        YY_BREAK
+case 208:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return NE_OP; }
</span><del>- YY_BREAK
-case 119:
</del><ins>+        YY_BREAK
+case 209:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LEFT_OP; }
</span><del>- YY_BREAK
-case 120:
</del><ins>+        YY_BREAK
+case 210:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return RIGHT_OP; }
</span><del>- YY_BREAK
-case 121:
</del><ins>+        YY_BREAK
+case 211:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return SEMICOLON; }
</span><del>- YY_BREAK
-case 122:
</del><ins>+        YY_BREAK
+case 212:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LEFT_BRACE; }
</span><del>- YY_BREAK
-case 123:
</del><ins>+        YY_BREAK
+case 213:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return RIGHT_BRACE; }
</span><del>- YY_BREAK
-case 124:
</del><ins>+        YY_BREAK
+case 214:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return COMMA; }
</span><del>- YY_BREAK
-case 125:
</del><ins>+        YY_BREAK
+case 215:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return COLON; }
</span><del>- YY_BREAK
-case 126:
</del><ins>+        YY_BREAK
+case 216:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return EQUAL; }
</span><del>- YY_BREAK
-case 127:
</del><ins>+        YY_BREAK
+case 217:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LEFT_PAREN; }
</span><del>- YY_BREAK
-case 128:
</del><ins>+        YY_BREAK
+case 218:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return RIGHT_PAREN; }
</span><del>- YY_BREAK
-case 129:
</del><ins>+        YY_BREAK
+case 219:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LEFT_BRACKET; }
</span><del>- YY_BREAK
-case 130:
</del><ins>+        YY_BREAK
+case 220:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return RIGHT_BRACKET; }
</span><del>- YY_BREAK
-case 131:
</del><ins>+        YY_BREAK
+case 221:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return DOT; }
</span><del>- YY_BREAK
-case 132:
</del><ins>+        YY_BREAK
+case 222:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return BANG; }
</span><del>- YY_BREAK
-case 133:
</del><ins>+        YY_BREAK
+case 223:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return DASH; }
</span><del>- YY_BREAK
-case 134:
</del><ins>+        YY_BREAK
+case 224:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return TILDE; }
</span><del>- YY_BREAK
-case 135:
</del><ins>+        YY_BREAK
+case 225:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return PLUS; }
</span><del>- YY_BREAK
-case 136:
</del><ins>+        YY_BREAK
+case 226:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return STAR; }
</span><del>- YY_BREAK
-case 137:
</del><ins>+        YY_BREAK
+case 227:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return SLASH; }
</span><del>- YY_BREAK
-case 138:
</del><ins>+        YY_BREAK
+case 228:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return PERCENT; }
</span><del>- YY_BREAK
-case 139:
</del><ins>+        YY_BREAK
+case 229:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return LEFT_ANGLE; }
</span><del>- YY_BREAK
-case 140:
</del><ins>+        YY_BREAK
+case 230:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return RIGHT_ANGLE; }
</span><del>- YY_BREAK
-case 141:
</del><ins>+        YY_BREAK
+case 231:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return VERTICAL_BAR; }
</span><del>- YY_BREAK
-case 142:
</del><ins>+        YY_BREAK
+case 232:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return CARET; }
</span><del>- YY_BREAK
-case 143:
</del><ins>+        YY_BREAK
+case 233:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return AMPERSAND; }
</span><del>- YY_BREAK
-case 144:
</del><ins>+        YY_BREAK
+case 234:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { return QUESTION; }
</span><del>- YY_BREAK
-case 145:
-/* rule 145 can match eol */
</del><ins>+        YY_BREAK
+case 235:
+/* rule 235 can match eol */
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { }
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx"> case YY_STATE_EOF(INITIAL):
</span><span class="cx"> { yyterminate(); }
</span><del>- YY_BREAK
-case 146:
</del><ins>+        YY_BREAK
+case 236:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { assert(false); return 0; }
</span><del>- YY_BREAK
-case 147:
</del><ins>+        YY_BREAK
+case 237:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> ECHO;
</span><del>- YY_BREAK
</del><ins>+        YY_BREAK
</ins><span class="cx">
</span><del>- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
</del><ins>+        case YY_END_OF_BUFFER:
+                {
+                /* Amount of text matched not including the EOB char. */
+                int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
</ins><span class="cx">
</span><del>- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
</del><ins>+                /* Undo the effects of YY_DO_BEFORE_ACTION. */
+                *yy_cp = yyg->yy_hold_char;
+                YY_RESTORE_YY_MORE_OFFSET
</ins><span class="cx">
</span><del>- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
</del><ins>+                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+                        {
+                        /* We're scanning a new file or input source. It's
+                         * possible that this happened because the user
+                         * just pointed yyin at a new source and called
+                         * yylex(). If so, then we have to assure
+                         * consistency between YY_CURRENT_BUFFER and our
+                         * globals. Here is the right place to do so, because
+                         * this is the first action (other than possibly a
+                         * back-up) that will match for the new input source.
+                         */
+                        yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+                        }
</ins><span class="cx">
</span><del>- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
</del><ins>+                /* Note that here we test for yy_c_buf_p "<=" to the position
+                 * of the first EOB in the buffer, since yy_c_buf_p will
+                 * already have been incremented past the NUL character
+                 * (since all states make transitions on EOB to the
+                 * end-of-buffer state). Contrast this with the test
+                 * in input().
+                 */
+                if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+                        { /* This was really a NUL. */
+                        yy_state_type yy_next_state;
</ins><span class="cx">
</span><del>- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
</del><ins>+                        yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
</ins><span class="cx">
</span><del>- yy_current_state = yy_get_previous_state( yyscanner );
</del><ins>+                        yy_current_state = yy_get_previous_state( yyscanner );
</ins><span class="cx">
</span><del>- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
</del><ins>+                        /* Okay, we're now positioned to make the NUL
+                         * transition. We couldn't have
+                         * yy_get_previous_state() go ahead and do it
+                         * for us because it doesn't know how to deal
+                         * with the possibility of jamming (and we don't
+                         * want to build jamming into it because then it
+                         * will run more slowly).
+                         */
</ins><span class="cx">
</span><del>- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
</del><ins>+                        yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
</ins><span class="cx">
</span><del>- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
</del><ins>+                        yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
</ins><span class="cx">
</span><del>- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
</del><ins>+                        if ( yy_next_state )
+                                {
+                                /* Consume the NUL. */
+                                yy_cp = ++yyg->yy_c_buf_p;
+                                yy_current_state = yy_next_state;
+                                goto yy_match;
+                                }
</ins><span class="cx">
</span><del>- else
- {
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
- }
- }
</del><ins>+                        else
+                                {
+                                yy_cp = yyg->yy_last_accepting_cpos;
+                                yy_current_state = yyg->yy_last_accepting_state;
+                                goto yy_find_action;
+                                }
+                        }
</ins><span class="cx">
</span><del>- else switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yyg->yy_did_buffer_switch_on_eof = 0;
</del><ins>+                else switch ( yy_get_next_buffer( yyscanner ) )
+                        {
+                        case EOB_ACT_END_OF_FILE:
+                                {
+                                yyg->yy_did_buffer_switch_on_eof = 0;
</ins><span class="cx">
</span><del>- if ( yywrap(yyscanner ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
</del><ins>+                                if ( yywrap(yyscanner ) )
+                                        {
+                                        /* Note: because we've taken care in
+                                         * yy_get_next_buffer() to have set up
+                                         * yytext, we can now set up
+                                         * yy_c_buf_p so that if some total
+                                         * hoser (like flex itself) wants to
+                                         * call the scanner after we return the
+                                         * YY_NULL, it'll still work - another
+                                         * YY_NULL will get returned.
+                                         */
+                                        yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
</ins><span class="cx">
</span><del>- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
</del><ins>+                                        yy_act = YY_STATE_EOF(YY_START);
+                                        goto do_action;
+                                        }
</ins><span class="cx">
</span><del>- else
- {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
</del><ins>+                                else
+                                        {
+                                        if ( ! yyg->yy_did_buffer_switch_on_eof )
+                                                YY_NEW_FILE;
+                                        }
+                                break;
+                                }
</ins><span class="cx">
</span><del>- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
</del><ins>+                        case EOB_ACT_CONTINUE_SCAN:
+                                yyg->yy_c_buf_p =
+                                        yyg->yytext_ptr + yy_amount_of_matched_text;
</ins><span class="cx">
</span><del>- yy_current_state = yy_get_previous_state( yyscanner );
</del><ins>+                                yy_current_state = yy_get_previous_state( yyscanner );
</ins><span class="cx">
</span><del>- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
</del><ins>+                                yy_cp = yyg->yy_c_buf_p;
+                                yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+                                goto yy_match;
</ins><span class="cx">
</span><del>- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
</del><ins>+                        case EOB_ACT_LAST_MATCH:
+                                yyg->yy_c_buf_p =
+                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
</ins><span class="cx">
</span><del>- yy_current_state = yy_get_previous_state( yyscanner );
</del><ins>+                                yy_current_state = yy_get_previous_state( yyscanner );
</ins><span class="cx">
</span><del>- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
</del><ins>+                                yy_cp = yyg->yy_c_buf_p;
+                                yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+                                goto yy_find_action;
+                        }
+                break;
+                }
</ins><span class="cx">
</span><del>- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
</del><ins>+        default:
+                YY_FATAL_ERROR(
+                        "fatal flex scanner internal error--no action found" );
+        } /* end of action switch */
+                } /* end of scanning one token */
</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="cx"> *
</span><span class="cx"> * Returns a code representing an action:
</span><del>- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
</del><ins>+ *        EOB_ACT_LAST_MATCH -
+ *        EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *        EOB_ACT_END_OF_FILE - end of file
</ins><span class="cx"> */
</span><span class="cx"> static int yy_get_next_buffer (yyscan_t yyscanner)
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><del>- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = yyg->yytext_ptr;
- register int number_to_move, i;
- int ret_val;
</del><ins>+        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+        register char *source = yyg->yytext_ptr;
+        register int number_to_move, i;
+        int ret_val;
</ins><span class="cx">
</span><del>- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
</del><ins>+        if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
+                YY_FATAL_ERROR(
+                "fatal flex scanner internal error--end of buffer missed" );
</ins><span class="cx">
</span><del>- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
</del><ins>+        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+                { /* Don't try to fill the buffer, so this is an EOF. */
+                if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+                        {
+                        /* We matched a single character, the EOB, so
+                         * treat this as a final EOF.
+                         */
+                        return EOB_ACT_END_OF_FILE;
+                        }
</ins><span class="cx">
</span><del>- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
</del><ins>+                else
+                        {
+                        /* We matched some text prior to the EOB, first
+                         * process it.
+                         */
+                        return EOB_ACT_LAST_MATCH;
+                        }
+                }
</ins><span class="cx">
</span><del>- /* Try to read more data. */
</del><ins>+        /* Try to read more data. */
</ins><span class="cx">
</span><del>- /* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
</del><ins>+        /* First move last chars to start of buffer. */
+        number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
</ins><span class="cx">
</span><del>- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
</del><ins>+        for ( i = 0; i < number_to_move; ++i )
+                *(dest++) = *(source++);
</ins><span class="cx">
</span><del>- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
</del><ins>+        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+                /* don't do the read, it's not guaranteed to return an EOF,
+                 * just force an EOF
+                 */
+                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
</ins><span class="cx">
</span><del>- else
- {
- yy_size_t num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
</del><ins>+        else
+                {
+                        yy_size_t num_to_read =
+                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
</ins><span class="cx">
</span><del>- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
</del><ins>+                while ( num_to_read <= 0 )
+                        { /* Not enough room in the buffer - grow it. */
</ins><span class="cx">
</span><del>- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
</del><ins>+                        /* just a shorter name for the current buffer */
+                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
</ins><span class="cx">
</span><del>- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
</del><ins>+                        int yy_c_buf_p_offset =
+                                (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
</ins><span class="cx">
</span><del>- if ( b->yy_is_our_buffer )
- {
- yy_size_t new_size = b->yy_buf_size * 2;
</del><ins>+                        if ( b->yy_is_our_buffer )
+                                {
+                                yy_size_t new_size = b->yy_buf_size * 2;
</ins><span class="cx">
</span><del>- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
</del><ins>+                                if ( new_size <= 0 )
+                                        b->yy_buf_size += b->yy_buf_size / 8;
+                                else
+                                        b->yy_buf_size *= 2;
</ins><span class="cx">
</span><del>- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
</del><ins>+                                b->yy_ch_buf = (char *)
+                                        /* Include room in for 2 EOB chars. */
+                                        yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+                                }
+                        else
+                                /* Can't grow it, we don't own it. */
+                                b->yy_ch_buf = 0;
</ins><span class="cx">
</span><del>- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
</del><ins>+                        if ( ! b->yy_ch_buf )
+                                YY_FATAL_ERROR(
+                                "fatal error - scanner input buffer overflow" );
</ins><span class="cx">
</span><del>- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
</del><ins>+                        yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
</ins><span class="cx">
</span><del>- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
</del><ins>+                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+                                                number_to_move - 1;
</ins><span class="cx">
</span><del>- }
</del><ins>+                        }
</ins><span class="cx">
</span><del>- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
</del><ins>+                if ( num_to_read > YY_READ_BUF_SIZE )
+                        num_to_read = YY_READ_BUF_SIZE;
</ins><span class="cx">
</span><del>- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
</del><ins>+                /* Read in more data. */
+                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+                        yyg->yy_n_chars, num_to_read );
</ins><span class="cx">
</span><del>- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
</del><ins>+                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+                }
</ins><span class="cx">
</span><del>- if ( yyg->yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart(yyin ,yyscanner);
- }
</del><ins>+        if ( yyg->yy_n_chars == 0 )
+                {
+                if ( number_to_move == YY_MORE_ADJ )
+                        {
+                        ret_val = EOB_ACT_END_OF_FILE;
+                        yyrestart(yyin ,yyscanner);
+                        }
</ins><span class="cx">
</span><del>- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
</del><ins>+                else
+                        {
+                        ret_val = EOB_ACT_LAST_MATCH;
+                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+                                YY_BUFFER_EOF_PENDING;
+                        }
+                }
</ins><span class="cx">
</span><del>- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
</del><ins>+        else
+                ret_val = EOB_ACT_CONTINUE_SCAN;
</ins><span class="cx">
</span><del>- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
</del><ins>+        if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+                /* Extend the array by 50%, plus the number we really need. */
+                yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+        }
</ins><span class="cx">
</span><del>- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
</del><ins>+        yyg->yy_n_chars += number_to_move;
+        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
</ins><span class="cx">
</span><del>- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
</del><ins>+        yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
</ins><span class="cx">
</span><del>- return ret_val;
</del><ins>+        return ret_val;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* yy_get_previous_state - get the state just before the EOB char was reached */
</span><span class="cx">
</span><span class="cx"> static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- register yy_state_type yy_current_state;
- register char *yy_cp;
</del><ins>+        register yy_state_type yy_current_state;
+        register char *yy_cp;
</ins><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><del>- yy_current_state = yyg->yy_start;
</del><ins>+        yy_current_state = yyg->yy_start;
</ins><span class="cx">
</span><del>- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 443 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
</del><ins>+        for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+                {
+                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+                if ( yy_accept[yy_current_state] )
+                        {
+                        yyg->yy_last_accepting_state = yy_current_state;
+                        yyg->yy_last_accepting_cpos = yy_cp;
+                        }
+                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                        {
+                        yy_current_state = (int) yy_def[yy_current_state];
+                        if ( yy_current_state >= 813 )
+                                yy_c = yy_meta[(unsigned int) yy_c];
+                        }
+                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+                }
</ins><span class="cx">
</span><del>- return yy_current_state;
</del><ins>+        return yy_current_state;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* yy_try_NUL_trans - try to make a transition on the NUL character
</span><span class="cx"> *
</span><span class="cx"> * synopsis
</span><del>- * next_state = yy_try_NUL_trans( current_state );
</del><ins>+ *        next_state = yy_try_NUL_trans( current_state );
</ins><span class="cx"> */
</span><span class="cx"> static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- register int yy_is_jam;
</del><ins>+        register int yy_is_jam;
</ins><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
</span><del>- register char *yy_cp = yyg->yy_c_buf_p;
</del><ins>+        register char *yy_cp = yyg->yy_c_buf_p;
</ins><span class="cx">
</span><del>- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 443 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 442);
</del><ins>+        register YY_CHAR yy_c = 1;
+        if ( yy_accept[yy_current_state] )
+                {
+                yyg->yy_last_accepting_state = yy_current_state;
+                yyg->yy_last_accepting_cpos = yy_cp;
+                }
+        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                {
+                yy_current_state = (int) yy_def[yy_current_state];
+                if ( yy_current_state >= 813 )
+                        yy_c = yy_meta[(unsigned int) yy_c];
+                }
+        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+        yy_is_jam = (yy_current_state == 812);
</ins><span class="cx">
</span><del>- (void)yyg;
- return yy_is_jam ? 0 : yy_current_state;
</del><ins>+        (void)yyg;
+        return yy_is_jam ? 0 : yy_current_state;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #ifndef YY_NO_INPUT
</span><span class="lines">@@ -2067,79 +2380,79 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> {
</span><del>- int c;
</del><ins>+        int c;
</ins><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><del>- *yyg->yy_c_buf_p = yyg->yy_hold_char;
</del><ins>+        *yyg->yy_c_buf_p = yyg->yy_hold_char;
</ins><span class="cx">
</span><del>- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
</del><ins>+        if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+                {
+                /* yy_c_buf_p now points to the character we want to return.
+                 * If this occurs *before* the EOB characters, then it's a
+                 * valid NUL; if not, then we've hit the end of the buffer.
+                 */
+                if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+                        /* This was really a NUL. */
+                        *yyg->yy_c_buf_p = '\0';
</ins><span class="cx">
</span><del>- else
- { /* need more input */
- yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
- ++yyg->yy_c_buf_p;
</del><ins>+                else
+                        { /* need more input */
+                        yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+                        ++yyg->yy_c_buf_p;
</ins><span class="cx">
</span><del>- switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
</del><ins>+                        switch ( yy_get_next_buffer( yyscanner ) )
+                                {
+                                case EOB_ACT_LAST_MATCH:
+                                        /* This happens because yy_g_n_b()
+                                         * sees that we've accumulated a
+                                         * token and flags that we need to
+                                         * try matching the token before
+                                         * proceeding. But for input(),
+                                         * there's no matching to consider.
+                                         * So convert the EOB_ACT_LAST_MATCH
+                                         * to EOB_ACT_END_OF_FILE.
+                                         */
</ins><span class="cx">
</span><del>- /* Reset buffer status. */
- yyrestart(yyin ,yyscanner);
</del><ins>+                                        /* Reset buffer status. */
+                                        yyrestart(yyin ,yyscanner);
</ins><span class="cx">
</span><del>- /*FALLTHROUGH*/
</del><ins>+                                        /*FALLTHROUGH*/
</ins><span class="cx">
</span><del>- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap(yyscanner ) )
- return EOF;
</del><ins>+                                case EOB_ACT_END_OF_FILE:
+                                        {
+                                        if ( yywrap(yyscanner ) )
+                                                return EOF;
</ins><span class="cx">
</span><del>- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
</del><ins>+                                        if ( ! yyg->yy_did_buffer_switch_on_eof )
+                                                YY_NEW_FILE;
</ins><span class="cx"> #ifdef __cplusplus
</span><del>- return yyinput(yyscanner);
</del><ins>+                                        return yyinput(yyscanner);
</ins><span class="cx"> #else
</span><del>- return input(yyscanner);
</del><ins>+                                        return input(yyscanner);
</ins><span class="cx"> #endif
</span><del>- }
</del><ins>+                                        }
</ins><span class="cx">
</span><del>- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
</del><ins>+                                case EOB_ACT_CONTINUE_SCAN:
+                                        yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+                                        break;
+                                }
+                        }
+                }
</ins><span class="cx">
</span><del>- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
</del><ins>+        c = *(unsigned char *) yyg->yy_c_buf_p;        /* cast for 8-bit char's */
+        *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
+        yyg->yy_hold_char = *++yyg->yy_c_buf_p;
</ins><span class="cx">
</span><del>- if ( c == '\n' )
-
</del><ins>+        if ( c == '\n' )
+                
</ins><span class="cx"> do{ yylineno++;
</span><span class="cx"> yycolumn=0;
</span><span class="cx"> }while(0)
</span><span class="cx"> ;
</span><span class="cx">
</span><del>- return c;
</del><ins>+        return c;
</ins><span class="cx"> }
</span><del>-#endif /* ifndef YY_NO_INPUT */
</del><ins>+#endif        /* ifndef YY_NO_INPUT */
</ins><span class="cx">
</span><span class="cx"> /** Immediately switch to a different input stream.
</span><span class="cx"> * @param input_file A readable stream.
</span><span class="lines">@@ -2150,14 +2463,14 @@
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><del>- if ( ! YY_CURRENT_BUFFER ){
</del><ins>+        if ( ! YY_CURRENT_BUFFER ){
</ins><span class="cx"> yyensure_buffer_stack (yyscanner);
</span><del>- YY_CURRENT_BUFFER_LVALUE =
</del><ins>+                YY_CURRENT_BUFFER_LVALUE =
</ins><span class="cx"> yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
</span><del>- }
</del><ins>+        }
</ins><span class="cx">
</span><del>- yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- yy_load_buffer_state(yyscanner );
</del><ins>+        yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+        yy_load_buffer_state(yyscanner );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Switch to a different input buffer.
</span><span class="lines">@@ -2168,41 +2481,41 @@
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><del>- /* TODO. We should be able to replace this entire function body
- * with
- * yypop_buffer_state();
- * yypush_buffer_state(new_buffer);
</del><ins>+        /* TODO. We should be able to replace this entire function body
+         * with
+         *                yypop_buffer_state();
+         *                yypush_buffer_state(new_buffer);
</ins><span class="cx"> */
</span><del>- yyensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
</del><ins>+        yyensure_buffer_stack (yyscanner);
+        if ( YY_CURRENT_BUFFER == new_buffer )
+                return;
</ins><span class="cx">
</span><del>- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
</del><ins>+        if ( YY_CURRENT_BUFFER )
+                {
+                /* Flush out information for old buffer. */
+                *yyg->yy_c_buf_p = yyg->yy_hold_char;
+                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+                }
</ins><span class="cx">
</span><del>- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state(yyscanner );
</del><ins>+        YY_CURRENT_BUFFER_LVALUE = new_buffer;
+        yy_load_buffer_state(yyscanner );
</ins><span class="cx">
</span><del>- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
</del><ins>+        /* We don't actually know whether we did this switch during
+         * EOF (yywrap()) processing, but the only time this flag
+         * is looked at is after yywrap() is called, so it's safe
+         * to go ahead and always set it.
+         */
+        yyg->yy_did_buffer_switch_on_eof = 1;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void yy_load_buffer_state (yyscan_t yyscanner)
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><del>- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
</del><ins>+        yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+        yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+        yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+        yyg->yy_hold_char = *yyg->yy_c_buf_p;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Allocate and initialize an input buffer state.
</span><span class="lines">@@ -2213,26 +2526,26 @@
</span><span class="cx"> */
</span><span class="cx"> YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- YY_BUFFER_STATE b;
</del><ins>+        YY_BUFFER_STATE b;
</ins><span class="cx">
</span><del>- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
</del><ins>+        b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+        if ( ! b )
+                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
</ins><span class="cx">
</span><del>- b->yy_buf_size = size;
</del><ins>+        b->yy_buf_size = size;
</ins><span class="cx">
</span><del>- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
</del><ins>+        /* yy_ch_buf has to be 2 characters longer than the size given because
+         * we need to put in 2 end-of-buffer characters.
+         */
+        b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
+        if ( ! b->yy_ch_buf )
+                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
</ins><span class="cx">
</span><del>- b->yy_is_our_buffer = 1;
</del><ins>+        b->yy_is_our_buffer = 1;
</ins><span class="cx">
</span><del>- yy_init_buffer(b,file ,yyscanner);
</del><ins>+        yy_init_buffer(b,file ,yyscanner);
</ins><span class="cx">
</span><del>- return b;
</del><ins>+        return b;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Destroy the buffer.
</span><span class="lines">@@ -2243,16 +2556,16 @@
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><del>- if ( ! b )
- return;
</del><ins>+        if ( ! b )
+                return;
</ins><span class="cx">
</span><del>- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
</del><ins>+        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
</ins><span class="cx">
</span><del>- if ( b->yy_is_our_buffer )
- yyfree((void *) b->yy_ch_buf ,yyscanner );
</del><ins>+        if ( b->yy_is_our_buffer )
+                yyfree((void *) b->yy_ch_buf ,yyscanner );
</ins><span class="cx">
</span><del>- yyfree((void *) b ,yyscanner );
</del><ins>+        yyfree((void *) b ,yyscanner );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* Initializes or reinitializes a buffer.
</span><span class="lines">@@ -2262,13 +2575,13 @@
</span><span class="cx"> static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
</span><span class="cx">
</span><span class="cx"> {
</span><del>- int oerrno = errno;
</del><ins>+        int oerrno = errno;
</ins><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><del>- yy_flush_buffer(b ,yyscanner);
</del><ins>+        yy_flush_buffer(b ,yyscanner);
</ins><span class="cx">
</span><del>- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
</del><ins>+        b->yy_input_file = file;
+        b->yy_fill_buffer = 1;
</ins><span class="cx">
</span><span class="cx"> /* If b is the current buffer, then yy_init_buffer was _probably_
</span><span class="cx"> * called from yyrestart() or through yy_get_next_buffer.
</span><span class="lines">@@ -2281,7 +2594,7 @@
</span><span class="cx">
</span><span class="cx"> b->yy_is_interactive = 0;
</span><span class="cx">
</span><del>- errno = oerrno;
</del><ins>+        errno = oerrno;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
</span><span class="lines">@@ -2291,25 +2604,25 @@
</span><span class="cx"> void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><del>- if ( ! b )
- return;
</del><ins>+        if ( ! b )
+                return;
</ins><span class="cx">
</span><del>- b->yy_n_chars = 0;
</del><ins>+        b->yy_n_chars = 0;
</ins><span class="cx">
</span><del>- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
</del><ins>+        /* We always need two end-of-buffer characters. The first causes
+         * a transition to the end-of-buffer state. The second causes
+         * a jam in that state.
+         */
+        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
</ins><span class="cx">
</span><del>- b->yy_buf_pos = &b->yy_ch_buf[0];
</del><ins>+        b->yy_buf_pos = &b->yy_ch_buf[0];
</ins><span class="cx">
</span><del>- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
</del><ins>+        b->yy_at_bol = 1;
+        b->yy_buffer_status = YY_BUFFER_NEW;
</ins><span class="cx">
</span><del>- if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state(yyscanner );
</del><ins>+        if ( b == YY_CURRENT_BUFFER )
+                yy_load_buffer_state(yyscanner );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Pushes the new state onto the stack. The new state becomes
</span><span class="lines">@@ -2321,28 +2634,28 @@
</span><span class="cx"> void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><del>- if (new_buffer == NULL)
- return;
</del><ins>+        if (new_buffer == NULL)
+                return;
</ins><span class="cx">
</span><del>- yyensure_buffer_stack(yyscanner);
</del><ins>+        yyensure_buffer_stack(yyscanner);
</ins><span class="cx">
</span><del>- /* This block is copied from yy_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
</del><ins>+        /* This block is copied from yy_switch_to_buffer. */
+        if ( YY_CURRENT_BUFFER )
+                {
+                /* Flush out information for old buffer. */
+                *yyg->yy_c_buf_p = yyg->yy_hold_char;
+                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+                }
</ins><span class="cx">
</span><del>- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
</del><ins>+        /* Only push if top exists. Otherwise, replace top. */
+        if (YY_CURRENT_BUFFER)
+                yyg->yy_buffer_stack_top++;
+        YY_CURRENT_BUFFER_LVALUE = new_buffer;
</ins><span class="cx">
</span><del>- /* copied from yy_switch_to_buffer. */
- yy_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
</del><ins>+        /* copied from yy_switch_to_buffer. */
+        yy_load_buffer_state(yyscanner );
+        yyg->yy_did_buffer_switch_on_eof = 1;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Removes and deletes the top of the stack, if present.
</span><span class="lines">@@ -2352,18 +2665,18 @@
</span><span class="cx"> void yypop_buffer_state (yyscan_t yyscanner)
</span><span class="cx"> {
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><del>- if (!YY_CURRENT_BUFFER)
- return;
</del><ins>+        if (!YY_CURRENT_BUFFER)
+                return;
</ins><span class="cx">
</span><del>- yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
</del><ins>+        yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+        YY_CURRENT_BUFFER_LVALUE = NULL;
+        if (yyg->yy_buffer_stack_top > 0)
+                --yyg->yy_buffer_stack_top;
</ins><span class="cx">
</span><del>- if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state(yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
</del><ins>+        if (YY_CURRENT_BUFFER) {
+                yy_load_buffer_state(yyscanner );
+                yyg->yy_did_buffer_switch_on_eof = 1;
+        }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* Allocates the stack if it does not exist.
</span><span class="lines">@@ -2371,46 +2684,46 @@
</span><span class="cx"> */
</span><span class="cx"> static void yyensure_buffer_stack (yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- yy_size_t num_to_alloc;
</del><ins>+        yy_size_t num_to_alloc;
</ins><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><del>- if (!yyg->yy_buffer_stack) {
</del><ins>+        if (!yyg->yy_buffer_stack) {
</ins><span class="cx">
</span><del>- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
</del><ins>+                /* First allocation is just for 2 elements, since we don't know if this
+                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+                 * immediate realloc on the next call.
</ins><span class="cx"> */
</span><del>- num_to_alloc = 1;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
</del><ins>+                num_to_alloc = 1;
+                yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
+                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                                , yyscanner);
+                if ( ! yyg->yy_buffer_stack )
+                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+                                                                
+                memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+                                
+                yyg->yy_buffer_stack_max = num_to_alloc;
+                yyg->yy_buffer_stack_top = 0;
+                return;
+        }
</ins><span class="cx">
</span><del>- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
</del><ins>+        if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
</ins><span class="cx">
</span><del>- /* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
</del><ins>+                /* Increase the buffer to prepare for a possible push. */
+                int grow_size = 8 /* arbitrary grow size */;
</ins><span class="cx">
</span><del>- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
</del><ins>+                num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
+                yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
+                                                                (yyg->yy_buffer_stack,
+                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                                , yyscanner);
+                if ( ! yyg->yy_buffer_stack )
+                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
</ins><span class="cx">
</span><del>- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
</del><ins>+                /* zero only the new slots.*/
+                memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
+                yyg->yy_buffer_stack_max = num_to_alloc;
+        }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Setup the input buffer state to scan directly from a user-specified character buffer.
</span><span class="lines">@@ -2421,31 +2734,31 @@
</span><span class="cx"> */
</span><span class="cx"> YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- YY_BUFFER_STATE b;
</del><ins>+        YY_BUFFER_STATE b;
</ins><span class="cx">
</span><del>- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
</del><ins>+        if ( size < 2 ||
+         base[size-2] != YY_END_OF_BUFFER_CHAR ||
+         base[size-1] != YY_END_OF_BUFFER_CHAR )
+                /* They forgot to leave room for the EOB's. */
+                return 0;
</ins><span class="cx">
</span><del>- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
</del><ins>+        b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+        if ( ! b )
+                YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
</ins><span class="cx">
</span><del>- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
</del><ins>+        b->yy_buf_size = size - 2;        /* "- 2" to take care of EOB's */
+        b->yy_buf_pos = b->yy_ch_buf = base;
+        b->yy_is_our_buffer = 0;
+        b->yy_input_file = 0;
+        b->yy_n_chars = b->yy_buf_size;
+        b->yy_is_interactive = 0;
+        b->yy_at_bol = 1;
+        b->yy_fill_buffer = 0;
+        b->yy_buffer_status = YY_BUFFER_NEW;
</ins><span class="cx">
</span><del>- yy_switch_to_buffer(b ,yyscanner );
</del><ins>+        yy_switch_to_buffer(b ,yyscanner );
</ins><span class="cx">
</span><del>- return b;
</del><ins>+        return b;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Setup the input buffer state to scan a string. The next call to yylex() will
</span><span class="lines">@@ -2459,7 +2772,7 @@
</span><span class="cx"> YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
</span><span class="cx"> {
</span><span class="cx">
</span><del>- return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
</del><ins>+        return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
</span><span class="lines">@@ -2471,32 +2784,32 @@
</span><span class="cx"> */
</span><span class="cx"> YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- yy_size_t i;
</del><ins>+        YY_BUFFER_STATE b;
+        char *buf;
+        yy_size_t n;
+        yy_size_t i;
</ins><span class="cx">
</span><del>- /* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) yyalloc(n ,yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
</del><ins>+        /* Get memory for full buffer, including space for trailing EOB's. */
+        n = _yybytes_len + 2;
+        buf = (char *) yyalloc(n ,yyscanner );
+        if ( ! buf )
+                YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
</ins><span class="cx">
</span><del>- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
</del><ins>+        for ( i = 0; i < _yybytes_len; ++i )
+                buf[i] = yybytes[i];
</ins><span class="cx">
</span><del>- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
</del><ins>+        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
</ins><span class="cx">
</span><del>- b = yy_scan_buffer(buf,n ,yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
</del><ins>+        b = yy_scan_buffer(buf,n ,yyscanner);
+        if ( ! b )
+                YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
</ins><span class="cx">
</span><del>- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
</del><ins>+        /* It's okay to grow etc. this buffer, and we should throw it
+         * away when we're done.
+         */
+        b->yy_is_our_buffer = 1;
</ins><span class="cx">
</span><del>- return b;
</del><ins>+        return b;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #ifndef YY_EXIT_FAILURE
</span><span class="lines">@@ -2505,26 +2818,26 @@
</span><span class="cx">
</span><span class="cx"> static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
</del><ins>+         (void) fprintf( stderr, "%s\n", msg );
+        exit( YY_EXIT_FAILURE );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* Redefine yyless() so it works in section 3 code. */
</span><span class="cx">
</span><span class="cx"> #undef yyless
</span><span class="cx"> #define yyless(n) \
</span><del>- do \
- { \
- /* Undo effects of setting up yytext. */ \
</del><ins>+        do \
+                { \
+                /* Undo effects of setting up yytext. */ \
</ins><span class="cx"> int yyless_macro_arg = (n); \
</span><span class="cx"> YY_LESS_LINENO(yyless_macro_arg);\
</span><del>- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
</del><ins>+                yytext[yyleng] = yyg->yy_hold_char; \
+                yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+                yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+                *yyg->yy_c_buf_p = '\0'; \
+                yyleng = yyless_macro_arg; \
+                } \
+        while ( 0 )
</ins><span class="cx">
</span><span class="cx"> /* Accessor methods (get/set functions) to struct members. */
</span><span class="cx">
</span><span class="lines">@@ -2743,9 +3056,9 @@
</span><span class="cx"> errno = EINVAL;
</span><span class="cx"> return 1;
</span><span class="cx"> }
</span><del>-
</del><ins>+        
</ins><span class="cx"> *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
</span><del>-
</del><ins>+        
</ins><span class="cx"> if (*ptr_yy_globals == NULL){
</span><span class="cx"> errno = ENOMEM;
</span><span class="cx"> return 1;
</span><span class="lines">@@ -2799,15 +3112,15 @@
</span><span class="cx"> struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx">
</span><span class="cx"> /* Pop the buffer stack, destroying each element. */
</span><del>- while(YY_CURRENT_BUFFER){
- yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state(yyscanner);
- }
</del><ins>+        while(YY_CURRENT_BUFFER){
+                yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+                YY_CURRENT_BUFFER_LVALUE = NULL;
+                yypop_buffer_state(yyscanner);
+        }
</ins><span class="cx">
</span><del>- /* Destroy the stack itself. */
- yyfree(yyg->yy_buffer_stack ,yyscanner);
- yyg->yy_buffer_stack = NULL;
</del><ins>+        /* Destroy the stack itself. */
+        yyfree(yyg->yy_buffer_stack ,yyscanner);
+        yyg->yy_buffer_stack = NULL;
</ins><span class="cx">
</span><span class="cx"> /* Destroy the start condition stack. */
</span><span class="cx"> yyfree(yyg->yy_start_stack ,yyscanner );
</span><span class="lines">@@ -2830,43 +3143,43 @@
</span><span class="cx"> #ifndef yytext_ptr
</span><span class="cx"> static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
</del><ins>+        register int i;
+        for ( i = 0; i < n; ++i )
+                s1[i] = s2[i];
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #ifdef YY_NEED_STRLEN
</span><span class="cx"> static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- register int n;
- for ( n = 0; s[n]; ++n )
- ;
</del><ins>+        register int n;
+        for ( n = 0; s[n]; ++n )
+               
</ins><span class="cx">
</span><del>- return n;
</del><ins>+        return n;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> void *yyalloc (yy_size_t size , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- return (void *) malloc( size );
</del><ins>+        return (void *) malloc( size );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
</del><ins>+        /* The cast to (char *) in the following accommodates both
+         * implementations that use char* generic pointers, and those
+         * that use void* generic pointers. It works with the latter
+         * because both ANSI C and C++ allow castless assignment from
+         * any pointer type to void*, and deal with argument conversions
+         * as though doing an assignment.
+         */
+        return (void *) realloc( (char *) ptr, size );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void yyfree (void * ptr , yyscan_t yyscanner)
</span><span class="cx"> {
</span><del>- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
</del><ins>+        free( (char *) ptr );        /* see yyrealloc() for (char *) cast */
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #define YYTABLES_NAME "yytables"
</span><span class="lines">@@ -2895,11 +3208,12 @@
</span><span class="cx"> struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
</span><span class="cx">
</span><span class="cx"> int token = IDENTIFIER;
</span><del>- TSymbol* symbol = yyextra->symbolTable.find(yytext);
</del><ins>+ TSymbol* symbol = yyextra->symbolTable.find(yytext, yyextra->shaderVersion);
</ins><span class="cx"> if (symbol && symbol->isVariable()) {
</span><span class="cx"> TVariable* variable = static_cast<TVariable*>(symbol);
</span><del>- if (variable->isUserType())
</del><ins>+ if (variable->isUserType()) {
</ins><span class="cx"> token = TYPE_NAME;
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx"> yylval->lex.symbol = symbol;
</span><span class="cx"> return token;
</span><span class="lines">@@ -2913,6 +3227,80 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int ES2_reserved_ES3_keyword(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_keyword_ES3_reserved(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion >= 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_ident_ES3_keyword(TParseContext *context, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
+ if (context->shaderVersion < 300)
+ {
+ yylval->lex.string = NewPoolTString(yytext);
+ return check_type(yyscanner);
+ }
+
+ return token;
+}
+
+int uint_constant(TParseContext *context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+ yyscan_t yyscanner = (yyscan_t) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
+ context->recover();
+ return 0;
+ }
+
+ if (!atoi_clamp(yytext, &(yylval->lex.i)))
+ yyextra->warning(*yylloc, "Integer overflow", yytext, "");
+
+ return UINTCONSTANT;
+}
+
+int floatsuffix_check(TParseContext* context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
+
+ if (context->shaderVersion < 300)
+ {
+ context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
+ context->recover();
+ return 0;
+ }
+
+ if (!atof_clamp(yytext, &(yylval->lex.f)))
+ yyextra->warning(*yylloc, "Float overflow", yytext, "");
+
+ return(FLOATCONSTANT);
+}
+
</ins><span class="cx"> void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) {
</span><span class="cx"> context->error(*lloc, reason, yyget_text(context->scanner));
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2962,7 +3350,6 @@
</span><span class="cx"> // Initialize preprocessor.
</span><span class="cx"> if (!context->preprocessor.init(count, string, length))
</span><span class="cx"> return 1;
</span><del>- context->preprocessor.setMaxTokenLength(SH_MAX_TOKEN_LENGTH);
</del><span class="cx">
</span><span class="cx"> // Define extension macros.
</span><span class="cx"> const TExtensionBehavior& extBehavior = context->extensionBehavior();
</span><span class="lines">@@ -2973,6 +3360,8 @@
</span><span class="cx"> if (context->fragmentPrecisionHigh)
</span><span class="cx"> context->preprocessor.predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
</span><span class="cx">
</span><ins>+ context->preprocessor.setMaxTokenSize(GetGlobalMaxTokenSize(context->shaderSpec));
+
</ins><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_tabcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">
</span><span class="cx">
</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">@@ -96,6 +96,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> # ifndef YY_NULL
</span><span class="cx"> # if defined __cplusplus && 201103L <= __cplusplus
</span><span class="cx"> # define YY_NULL nullptr
</span><span class="lines">@@ -128,7 +129,6 @@
</span><span class="cx">
</span><span class="cx"> #define YYLTYPE TSourceLoc
</span><span class="cx"> #define YYLTYPE_IS_DECLARED 1
</span><del>-#define SH_MAX_TOKEN_LENGTH 256 // WebGL spec.
</del><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -149,88 +149,121 @@
</span><span class="cx"> BOOL_TYPE = 265,
</span><span class="cx"> FLOAT_TYPE = 266,
</span><span class="cx"> INT_TYPE = 267,
</span><del>- BREAK = 268,
- CONTINUE = 269,
- DO = 270,
- ELSE = 271,
- FOR = 272,
- IF = 273,
- DISCARD = 274,
- RETURN = 275,
- BVEC2 = 276,
- BVEC3 = 277,
- BVEC4 = 278,
- IVEC2 = 279,
- IVEC3 = 280,
- IVEC4 = 281,
- VEC2 = 282,
- VEC3 = 283,
- VEC4 = 284,
- MATRIX2 = 285,
- MATRIX3 = 286,
- MATRIX4 = 287,
- IN_QUAL = 288,
- OUT_QUAL = 289,
- INOUT_QUAL = 290,
- UNIFORM = 291,
- VARYING = 292,
- STRUCT = 293,
- VOID_TYPE = 294,
- WHILE = 295,
- SAMPLER2D = 296,
- SAMPLERCUBE = 297,
- SAMPLER_EXTERNAL_OES = 298,
- SAMPLER2DRECT = 299,
- IDENTIFIER = 300,
- TYPE_NAME = 301,
- FLOATCONSTANT = 302,
- INTCONSTANT = 303,
- BOOLCONSTANT = 304,
- LEFT_OP = 305,
- RIGHT_OP = 306,
- INC_OP = 307,
- DEC_OP = 308,
- LE_OP = 309,
- GE_OP = 310,
- EQ_OP = 311,
- NE_OP = 312,
- AND_OP = 313,
- OR_OP = 314,
- XOR_OP = 315,
- MUL_ASSIGN = 316,
- DIV_ASSIGN = 317,
- ADD_ASSIGN = 318,
- MOD_ASSIGN = 319,
- LEFT_ASSIGN = 320,
- RIGHT_ASSIGN = 321,
- AND_ASSIGN = 322,
- XOR_ASSIGN = 323,
- OR_ASSIGN = 324,
- SUB_ASSIGN = 325,
- LEFT_PAREN = 326,
- RIGHT_PAREN = 327,
- LEFT_BRACKET = 328,
- RIGHT_BRACKET = 329,
- LEFT_BRACE = 330,
- RIGHT_BRACE = 331,
- DOT = 332,
- COMMA = 333,
- COLON = 334,
- EQUAL = 335,
- SEMICOLON = 336,
- BANG = 337,
- DASH = 338,
- TILDE = 339,
- PLUS = 340,
- STAR = 341,
- SLASH = 342,
- PERCENT = 343,
- LEFT_ANGLE = 344,
- RIGHT_ANGLE = 345,
- VERTICAL_BAR = 346,
- CARET = 347,
- AMPERSAND = 348,
- QUESTION = 349
</del><ins>+ 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"> };
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -245,6 +278,7 @@
</span><span class="cx"> TString *string;
</span><span class="cx"> float f;
</span><span class="cx"> int i;
</span><ins>+ unsigned int u;
</ins><span class="cx"> bool b;
</span><span class="cx"> };
</span><span class="cx"> TSymbol* symbol;
</span><span class="lines">@@ -260,6 +294,7 @@
</span><span class="cx"> union {
</span><span class="cx"> TPublicType type;
</span><span class="cx"> TPrecision precision;
</span><ins>+ TLayoutQualifier layoutQualifier;
</ins><span class="cx"> TQualifier qualifier;
</span><span class="cx"> TFunction* function;
</span><span class="cx"> TParameter param;
</span><span class="lines">@@ -342,8 +377,22 @@
</span><span class="cx"> } \
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#define ES2_ONLY(S, L) { \
+ if (context->shaderVersion != 100) { \
+ context->error(L, " supported in GLSL ES 1.00 only ", S); \
+ context->recover(); \
+ } \
+}
</ins><span class="cx">
</span><ins>+#define ES3_ONLY(TOKEN, LINE, REASON) { \
+ if (context->shaderVersion != 300) { \
+ context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
+ context->recover(); \
+ } \
+}
</ins><span class="cx">
</span><ins>+
+
</ins><span class="cx"> #ifdef short
</span><span class="cx"> # undef short
</span><span class="cx"> #endif
</span><span class="lines">@@ -484,7 +533,7 @@
</span><span class="cx"> # endif
</span><span class="cx"> # if (defined __cplusplus && ! defined EXIT_SUCCESS \
</span><span class="cx"> && ! ((defined YYMALLOC || defined malloc) \
</span><del>- && (defined YYFREE || defined free)))
</del><ins>+         && (defined YYFREE || defined free)))
</ins><span class="cx"> # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> # ifndef EXIT_SUCCESS
</span><span class="cx"> # define EXIT_SUCCESS 0
</span><span class="lines">@@ -510,8 +559,8 @@
</span><span class="cx">
</span><span class="cx"> #if (! defined yyoverflow \
</span><span class="cx"> && (! defined __cplusplus \
</span><del>- || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
- && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
</del><ins>+         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
+         && defined YYSTYPE_IS_TRIVIAL && 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">@@ -537,15 +586,15 @@
</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 (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
</del><ins>+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                                \
+ do                                                                        \
+ {                                                                        \
+        YYSIZE_T yynewbytes;                                                \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                        \
+        Stack = &yyptr->Stack_alloc;                                        \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                                \
+ }                                                                        \
</ins><span class="cx"> while (YYID (0))
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="lines">@@ -571,24 +620,24 @@
</span><span class="cx"> #endif /* !YYCOPY_NEEDED */
</span><span class="cx">
</span><span class="cx"> /* YYFINAL -- State number of the termination state. */
</span><del>-#define YYFINAL 74
</del><ins>+#define YYFINAL 114
</ins><span class="cx"> /* YYLAST -- Last index in YYTABLE. */
</span><del>-#define YYLAST 1490
</del><ins>+#define YYLAST 2375
</ins><span class="cx">
</span><span class="cx"> /* YYNTOKENS -- Number of terminals. */
</span><del>-#define YYNTOKENS 95
</del><ins>+#define YYNTOKENS 128
</ins><span class="cx"> /* YYNNTS -- Number of nonterminals. */
</span><del>-#define YYNNTS 84
</del><ins>+#define YYNNTS 91
</ins><span class="cx"> /* YYNRULES -- Number of rules. */
</span><del>-#define YYNRULES 202
</del><ins>+#define YYNRULES 250
</ins><span class="cx"> /* YYNRULES -- Number of states. */
</span><del>-#define YYNSTATES 307
</del><ins>+#define YYNSTATES 373
</ins><span class="cx">
</span><span class="cx"> /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
</span><span class="cx"> #define YYUNDEFTOK 2
</span><del>-#define YYMAXUTOK 349
</del><ins>+#define YYMAXUTOK 382
</ins><span class="cx">
</span><del>-#define YYTRANSLATE(YYX) \
</del><ins>+#define YYTRANSLATE(YYX)                                                \
</ins><span class="cx"> ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
</span><span class="cx">
</span><span class="cx"> /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
</span><span class="lines">@@ -628,7 +677,11 @@
</span><span class="cx"> 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
</span><span class="cx"> 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
</span><span class="cx"> 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
</span><del>- 85, 86, 87, 88, 89, 90, 91, 92, 93, 94
</del><ins>+ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+ 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
+ 125, 126, 127
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #if YYDEBUG
</span><span class="lines">@@ -637,115 +690,138 @@
</span><span class="cx"> static const yytype_uint16 yyprhs[] =
</span><span class="cx"> {
</span><span class="cx"> 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
</span><del>- 21, 23, 28, 30, 34, 37, 40, 42, 44, 46,
- 50, 53, 56, 59, 61, 64, 68, 71, 73, 75,
- 77, 80, 83, 86, 88, 90, 92, 94, 98, 102,
- 104, 108, 112, 114, 116, 120, 124, 128, 132, 134,
- 138, 142, 144, 146, 148, 150, 154, 156, 160, 162,
- 166, 168, 174, 176, 180, 182, 184, 186, 188, 190,
- 192, 196, 198, 201, 204, 209, 212, 214, 216, 219,
- 223, 227, 230, 236, 240, 243, 247, 250, 251, 253,
- 255, 257, 259, 261, 265, 271, 278, 284, 286, 289,
- 294, 300, 305, 308, 310, 313, 315, 317, 319, 322,
- 324, 326, 329, 331, 333, 335, 337, 342, 344, 346,
- 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
- 368, 370, 372, 374, 376, 378, 380, 382, 384, 386,
- 387, 394, 395, 401, 403, 406, 410, 412, 416, 418,
- 423, 425, 427, 429, 431, 433, 435, 437, 439, 441,
- 444, 445, 446, 452, 454, 456, 457, 460, 461, 464,
- 467, 471, 473, 476, 478, 481, 487, 491, 493, 495,
- 500, 501, 508, 509, 518, 519, 527, 529, 531, 533,
- 534, 537, 541, 544, 547, 550, 554, 557, 559, 562,
- 564, 566, 567
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYRHS -- A `-1'-separated list of the rules' RHS. */
</span><span class="cx"> static const yytype_int16 yyrhs[] =
</span><span class="cx"> {
</span><del>- 175, 0, -1, 45, -1, 46, -1, 45, -1, 97,
- -1, 48, -1, 47, -1, 49, -1, 71, 124, 72,
- -1, 98, -1, 99, 73, 100, 74, -1, 101, -1,
- 99, 77, 96, -1, 99, 52, -1, 99, 53, -1,
- 124, -1, 102, -1, 103, -1, 99, 77, 103, -1,
- 105, 72, -1, 104, 72, -1, 106, 39, -1, 106,
- -1, 106, 122, -1, 105, 78, 122, -1, 107, 71,
- -1, 142, -1, 45, -1, 99, -1, 52, 108, -1,
- 53, 108, -1, 109, 108, -1, 85, -1, 83, -1,
- 82, -1, 108, -1, 110, 86, 108, -1, 110, 87,
- 108, -1, 110, -1, 111, 85, 110, -1, 111, 83,
- 110, -1, 111, -1, 112, -1, 113, 89, 112, -1,
- 113, 90, 112, -1, 113, 54, 112, -1, 113, 55,
- 112, -1, 113, -1, 114, 56, 113, -1, 114, 57,
- 113, -1, 114, -1, 115, -1, 116, -1, 117, -1,
- 118, 58, 117, -1, 118, -1, 119, 60, 118, -1,
- 119, -1, 120, 59, 119, -1, 120, -1, 120, 94,
- 124, 79, 122, -1, 121, -1, 108, 123, 122, -1,
- 80, -1, 61, -1, 62, -1, 63, -1, 70, -1,
- 122, -1, 124, 78, 122, -1, 121, -1, 127, 81,
- -1, 135, 81, -1, 7, 140, 141, 81, -1, 128,
- 72, -1, 130, -1, 129, -1, 130, 132, -1, 129,
- 78, 132, -1, 137, 45, 71, -1, 139, 96, -1,
- 139, 96, 73, 125, 74, -1, 138, 133, 131, -1,
- 133, 131, -1, 138, 133, 134, -1, 133, 134, -1,
- -1, 33, -1, 34, -1, 35, -1, 139, -1, 136,
- -1, 135, 78, 96, -1, 135, 78, 96, 73, 74,
- -1, 135, 78, 96, 73, 125, 74, -1, 135, 78,
- 96, 80, 150, -1, 137, -1, 137, 96, -1, 137,
- 96, 73, 74, -1, 137, 96, 73, 125, 74, -1,
- 137, 96, 80, 150, -1, 3, 45, -1, 139, -1,
- 138, 139, -1, 9, -1, 8, -1, 37, -1, 3,
- 37, -1, 36, -1, 141, -1, 140, 141, -1, 4,
- -1, 5, -1, 6, -1, 142, -1, 142, 73, 125,
- 74, -1, 39, -1, 11, -1, 12, -1, 10, -1,
- 27, -1, 28, -1, 29, -1, 21, -1, 22, -1,
- 23, -1, 24, -1, 25, -1, 26, -1, 30, -1,
- 31, -1, 32, -1, 41, -1, 42, -1, 43, -1,
- 44, -1, 143, -1, 46, -1, -1, 38, 96, 75,
- 144, 146, 76, -1, -1, 38, 75, 145, 146, 76,
- -1, 147, -1, 146, 147, -1, 139, 148, 81, -1,
- 149, -1, 148, 78, 149, -1, 96, -1, 96, 73,
- 125, 74, -1, 122, -1, 126, -1, 154, -1, 153,
- -1, 151, -1, 163, -1, 164, -1, 167, -1, 174,
- -1, 75, 76, -1, -1, -1, 75, 155, 162, 156,
- 76, -1, 161, -1, 153, -1, -1, 159, 161, -1,
- -1, 160, 153, -1, 75, 76, -1, 75, 162, 76,
- -1, 152, -1, 162, 152, -1, 81, -1, 124, 81,
- -1, 18, 71, 124, 72, 165, -1, 158, 16, 158,
- -1, 158, -1, 124, -1, 137, 96, 80, 150, -1,
- -1, 40, 71, 168, 166, 72, 157, -1, -1, 15,
- 169, 158, 40, 71, 124, 72, 81, -1, -1, 17,
- 71, 170, 171, 173, 72, 157, -1, 163, -1, 151,
- -1, 166, -1, -1, 172, 81, -1, 172, 81, 124,
- -1, 14, 81, -1, 13, 81, -1, 20, 81, -1,
- 20, 124, 81, -1, 19, 81, -1, 176, -1, 175,
- 176, -1, 177, -1, 126, -1, -1, 127, 178, 161,
- -1
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
</span><span class="cx"> static const yytype_uint16 yyrline[] =
</span><span class="cx"> {
</span><del>- 0, 180, 180, 181, 184, 239, 242, 247, 252, 257,
- 263, 266, 269, 272, 367, 377, 390, 398, 498, 501,
- 509, 512, 518, 522, 529, 535, 544, 552, 607, 617,
- 620, 630, 640, 661, 662, 663, 668, 669, 677, 688,
- 689, 697, 708, 712, 713, 723, 733, 743, 756, 757,
- 767, 780, 784, 788, 792, 793, 806, 807, 820, 821,
- 834, 835, 852, 853, 866, 867, 868, 869, 870, 874,
- 877, 888, 896, 923, 928, 942, 997, 1000, 1007, 1015,
- 1036, 1057, 1067, 1095, 1100, 1110, 1115, 1125, 1128, 1131,
- 1134, 1140, 1147, 1150, 1172, 1190, 1214, 1237, 1241, 1259,
- 1267, 1299, 1319, 1340, 1349, 1372, 1375, 1381, 1389, 1397,
- 1405, 1415, 1422, 1425, 1428, 1434, 1437, 1452, 1456, 1460,
- 1464, 1468, 1473, 1478, 1483, 1488, 1493, 1498, 1503, 1508,
- 1513, 1518, 1523, 1528, 1532, 1536, 1544, 1552, 1556, 1569,
- 1569, 1583, 1583, 1592, 1595, 1611, 1644, 1648, 1654, 1661,
- 1676, 1680, 1684, 1685, 1691, 1692, 1693, 1694, 1695, 1699,
- 1700, 1700, 1700, 1710, 1711, 1715, 1715, 1716, 1716, 1721,
- 1724, 1734, 1737, 1743, 1744, 1748, 1756, 1760, 1770, 1775,
- 1792, 1792, 1797, 1797, 1804, 1804, 1812, 1815, 1821, 1824,
- 1830, 1834, 1841, 1848, 1855, 1862, 1873, 1882, 1886, 1893,
- 1896, 1902, 1902
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -756,13 +832,20 @@
</span><span class="cx"> {
</span><span class="cx"> "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
</span><span class="cx"> "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
</span><del>- "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE",
- "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3",
- "BVEC4", "IVEC2", "IVEC3", "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2",
</del><ins>+ "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
+ "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
+ "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
+ "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2",
</ins><span class="cx"> "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
</span><del>- "VARYING", "STRUCT", "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE",
- "SAMPLER_EXTERNAL_OES", "SAMPLER2DRECT", "IDENTIFIER", "TYPE_NAME",
- "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT", "LEFT_OP", "RIGHT_OP",
</del><ins>+ "VARYING", "MATRIX2x3", "MATRIX3x2", "MATRIX2x4", "MATRIX4x2",
+ "MATRIX3x4", "MATRIX4x3", "CENTROID", "FLAT", "SMOOTH", "STRUCT",
+ "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES",
+ "SAMPLER2DRECT", "SAMPLER2DARRAY", "ISAMPLER2D", "ISAMPLER3D",
+ "ISAMPLERCUBE", "ISAMPLER2DARRAY", "USAMPLER2D", "USAMPLER3D",
+ "USAMPLERCUBE", "USAMPLER2DARRAY", "SAMPLER3D", "SAMPLER3DRECT",
+ "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", "SAMPLER2DARRAYSHADOW", "LAYOUT",
+ "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
+ "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP",
</ins><span class="cx"> "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
</span><span class="cx"> "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
</span><span class="cx"> "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
</span><span class="lines">@@ -782,12 +865,15 @@
</span><span class="cx"> "logical_and_expression", "logical_xor_expression",
</span><span class="cx"> "logical_or_expression", "conditional_expression",
</span><span class="cx"> "assignment_expression", "assignment_operator", "expression",
</span><del>- "constant_expression", "declaration", "function_prototype",
- "function_declarator", "function_header_with_parameters",
- "function_header", "parameter_declarator", "parameter_declaration",
- "parameter_qualifier", "parameter_type_specifier",
- "init_declarator_list", "single_declaration", "fully_specified_type",
- "type_qualifier", "type_specifier", "precision_qualifier",
</del><ins>+ "constant_expression", "enter_struct", "declaration",
+ "function_prototype", "function_declarator",
+ "function_header_with_parameters", "function_header",
+ "parameter_declarator", "parameter_declaration", "parameter_qualifier",
+ "parameter_type_specifier", "init_declarator_list", "single_declaration",
+ "fully_specified_type", "interpolation_qualifier",
+ "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
+ "type_specifier", "precision_qualifier", "layout_qualifier",
+ "layout_qualifier_id_list", "layout_qualifier_id",
</ins><span class="cx"> "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
</span><span class="cx"> "$@1", "$@2", "struct_declaration_list", "struct_declaration",
</span><span class="cx"> "struct_declarator_list", "struct_declarator", "initializer",
</span><span class="lines">@@ -816,60 +902,73 @@
</span><span class="cx"> 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
</span><span class="cx"> 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
</span><span class="cx"> 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
</span><del>- 345, 346, 347, 348, 349
</del><ins>+ 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
+ 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
+ 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
+ 375, 376, 377, 378, 379, 380, 381, 382
</ins><span class="cx"> };
</span><span class="cx"> # endif
</span><span class="cx">
</span><span class="cx"> /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
</span><span class="cx"> static const yytype_uint8 yyr1[] =
</span><span class="cx"> {
</span><del>- 0, 95, 96, 96, 97, 98, 98, 98, 98, 98,
- 99, 99, 99, 99, 99, 99, 100, 101, 102, 102,
- 103, 103, 104, 104, 105, 105, 106, 107, 107, 108,
- 108, 108, 108, 109, 109, 109, 110, 110, 110, 111,
- 111, 111, 112, 113, 113, 113, 113, 113, 114, 114,
- 114, 115, 116, 117, 118, 118, 119, 119, 120, 120,
- 121, 121, 122, 122, 123, 123, 123, 123, 123, 124,
- 124, 125, 126, 126, 126, 127, 128, 128, 129, 129,
- 130, 131, 131, 132, 132, 132, 132, 133, 133, 133,
- 133, 134, 135, 135, 135, 135, 135, 136, 136, 136,
- 136, 136, 136, 137, 137, 138, 138, 138, 138, 138,
- 139, 139, 140, 140, 140, 141, 141, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 144,
- 143, 145, 143, 146, 146, 147, 148, 148, 149, 149,
- 150, 151, 152, 152, 153, 153, 153, 153, 153, 154,
- 155, 156, 154, 157, 157, 159, 158, 160, 158, 161,
- 161, 162, 162, 163, 163, 164, 165, 165, 166, 166,
- 168, 167, 169, 167, 170, 167, 171, 171, 172, 172,
- 173, 173, 174, 174, 174, 174, 174, 175, 175, 176,
- 176, 178, 177
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
</span><span class="cx"> static const yytype_uint8 yyr2[] =
</span><span class="cx"> {
</span><del>- 0, 2, 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, 4, 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, 2, 1,
- 1, 2, 1, 1, 1, 1, 4, 1, 1, 1,
</del><ins>+ 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,
</ins><span class="cx"> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
</span><del>- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 6, 0, 5, 1, 2, 3, 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>+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
</span><span class="lines">@@ -877,421 +976,613 @@
</span><span class="cx"> means the default is an error. */
</span><span class="cx"> static const yytype_uint8 yydefact[] =
</span><span class="cx"> {
</span><del>- 0, 0, 112, 113, 114, 0, 106, 105, 120, 118,
- 119, 124, 125, 126, 127, 128, 129, 121, 122, 123,
- 130, 131, 132, 109, 107, 0, 117, 133, 134, 135,
- 136, 138, 200, 201, 0, 77, 87, 0, 92, 97,
- 0, 103, 0, 110, 115, 137, 0, 197, 199, 108,
- 102, 0, 2, 3, 141, 0, 72, 0, 75, 87,
- 0, 88, 89, 90, 78, 0, 87, 0, 73, 2,
- 98, 104, 111, 0, 1, 198, 0, 0, 139, 0,
- 202, 79, 84, 86, 91, 0, 93, 80, 0, 0,
- 4, 7, 6, 8, 0, 0, 0, 35, 34, 33,
- 5, 10, 29, 12, 17, 18, 0, 0, 23, 0,
- 36, 0, 39, 42, 43, 48, 51, 52, 53, 54,
- 56, 58, 60, 71, 0, 27, 74, 0, 0, 143,
- 0, 0, 0, 182, 0, 0, 0, 0, 0, 160,
- 169, 173, 36, 62, 69, 0, 151, 0, 115, 154,
- 171, 153, 152, 0, 155, 156, 157, 158, 81, 83,
- 85, 0, 0, 99, 0, 150, 101, 30, 31, 0,
- 14, 15, 0, 0, 21, 20, 0, 22, 24, 26,
- 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 116, 148, 0, 146, 142,
- 144, 0, 193, 192, 167, 184, 0, 196, 194, 0,
- 180, 159, 0, 65, 66, 67, 68, 64, 0, 0,
- 174, 170, 172, 0, 94, 0, 96, 100, 9, 0,
- 16, 2, 3, 13, 19, 25, 37, 38, 41, 40,
- 46, 47, 44, 45, 49, 50, 55, 57, 59, 0,
- 0, 0, 145, 140, 0, 0, 0, 0, 0, 195,
- 0, 161, 63, 70, 0, 95, 11, 0, 0, 147,
- 0, 166, 168, 187, 186, 189, 167, 178, 0, 0,
- 0, 82, 61, 149, 0, 188, 0, 0, 177, 175,
- 0, 0, 162, 0, 190, 0, 167, 0, 164, 181,
- 163, 0, 191, 185, 176, 179, 183
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYDEFGOTO[NTERM-NUM]. */
</span><span class="cx"> static const yytype_int16 yydefgoto[] =
</span><span class="cx"> {
</span><del>- -1, 196, 100, 101, 102, 229, 103, 104, 105, 106,
- 107, 108, 109, 142, 111, 112, 113, 114, 115, 116,
- 117, 118, 119, 120, 121, 122, 143, 144, 218, 145,
- 124, 146, 147, 34, 35, 36, 82, 64, 65, 83,
- 37, 38, 39, 40, 41, 42, 43, 125, 45, 130,
- 77, 128, 129, 197, 198, 166, 149, 150, 151, 152,
- 212, 280, 299, 254, 255, 256, 300, 153, 154, 155,
- 289, 279, 156, 260, 204, 257, 275, 286, 287, 157,
- 46, 47, 48, 57
</del><ins>+ -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,
+ 126, 66, 67, 68, 69, 101, 70, 71, 72, 73,
+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
</span><span class="cx"> STATE-NUM. */
</span><del>-#define YYPACT_NINF -261
</del><ins>+#define YYPACT_NINF -309
</ins><span class="cx"> static const yytype_int16 yypact[] =
</span><span class="cx"> {
</span><del>- 1327, -20, -261, -261, -261, 113, -261, -261, -261, -261,
- -261, -261, -261, -261, -261, -261, -261, -261, -261, -261,
- -261, -261, -261, -261, -261, -19, -261, -261, -261, -261,
- -261, -261, -261, -61, -40, -28, 75, -7, -261, 24,
- 1370, -261, 1444, -261, -11, -261, 1283, -261, -261, -261,
- -261, 1444, -261, -261, -261, 6, -261, 54, -261, 88,
- 62, -261, -261, -261, -261, 1370, 59, 91, -261, 36,
- -50, -261, -261, 1051, -261, -261, 63, 1370, -261, 293,
- -261, -261, -261, -261, 91, 1370, -12, -261, 856, 1051,
- 77, -261, -261, -261, 1051, 1051, 1051, -261, -261, -261,
- -261, -261, -14, -261, -261, -261, 84, -44, 1116, 95,
- -261, 1051, 53, 3, -261, -36, 89, -261, -261, -261,
- 104, 107, -45, -261, 96, -261, -261, 91, 1184, -261,
- 1370, 92, 93, -261, 98, 101, 94, 921, 105, 102,
- -261, -261, 72, -261, -261, 9, -261, -61, 42, -261,
- -261, -261, -261, 376, -261, -261, -261, -261, 106, -261,
- -261, 986, 1051, -261, 103, -261, -261, -261, -261, -41,
- -261, -261, 1051, 1407, -261, -261, 1051, 110, -261, -261,
- -261, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051,
- 1051, 1051, 1051, 1051, 1051, -261, 109, 23, -261, -261,
- -261, 1227, -261, -261, 111, -261, 1051, -261, -261, 25,
- -261, -261, 459, -261, -261, -261, -261, -261, 1051, 1051,
- -261, -261, -261, 1051, -261, 114, -261, -261, -261, 115,
- 112, 77, 116, -261, -261, -261, -261, -261, 53, 53,
- -261, -261, -261, -261, -36, -36, -261, 104, 107, 76,
- 1051, 91, -261, -261, 145, 54, 625, 708, -6, -261,
- 791, 459, -261, -261, 117, -261, -261, 1051, 120, -261,
- 124, -261, -261, -261, -261, 791, 111, 112, 91, 125,
- 122, -261, -261, -261, 1051, -261, 118, 128, 180, -261,
- 126, 542, -261, -5, 1051, 542, 111, 1051, -261, -261,
- -261, 123, 112, -261, -261, -261, -261
</del><ins>+ 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYPGOTO[NTERM-NUM]. */
</span><span class="cx"> static const yytype_int16 yypgoto[] =
</span><span class="cx"> {
</span><del>- -261, -24, -261, -261, -261, -261, -261, -261, 34, -261,
- -261, -261, -261, 32, -261, -33, -261, -27, -26, -261,
- -261, -261, 14, 16, 18, -261, -66, -87, -261, -92,
- -85, 11, 12, -261, -261, -261, 141, 150, 161, 143,
- -261, -261, -231, 5, -30, 224, -18, 0, -261, -261,
- -261, 100, -119, -261, -17, -156, -25, -145, -243, -261,
- -261, -261, -64, -260, -261, -261, -52, 21, -22, -261,
- -261, -39, -261, -261, -261, -261, -261, -261, -261, -261,
- -261, 191, -261, -261
</del><ins>+ -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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
</span><span class="cx"> positive, shift that token. If negative, reduce the rule which
</span><span class="cx"> number is the opposite. If YYTABLE_NINF, syntax error. */
</span><del>-#define YYTABLE_NINF -166
</del><ins>+#define YYTABLE_NINF -214
</ins><span class="cx"> static const yytype_int16 yytable[] =
</span><span class="cx"> {
</span><del>- 44, 55, 165, 164, 169, 80, 226, 123, 222, 200,
- 71, 32, 33, 272, 193, 70, 288, 49, 185, 186,
- 56, 178, 123, 88, 72, 50, 52, 53, 175, 278,
- 89, 228, 58, 76, 176, 84, 304, 219, 170, 171,
- 44, 66, 44, 86, 278, 209, 44, 127, 298, 194,
- 59, 44, 298, 187, 188, 84, 54, 32, 33, 172,
- 158, 161, 73, 173, 66, 44, 276, 301, 162, 69,
- 53, 67, 219, 219, 68, 165, 225, 44, 60, 148,
- 230, 78, 200, 6, 7, 44, 183, 219, 184, 235,
- 220, 60, 61, 62, 63, 123, 6, 7, 127, 49,
- 127, 251, 249, 219, 252, 110, 259, 87, 61, 62,
- 63, 23, 24, -27, 258, 73, 222, 2, 3, 4,
- 110, 61, 62, 63, 23, 24, 167, 168, 44, 79,
- 44, 262, 263, 213, 214, 215, 52, 53, 264, 181,
- 182, 305, 216, 180, 126, 189, 190, -76, -28, 233,
- 238, 239, 217, 148, 219, 267, 174, 123, 240, 241,
- 242, 243, 191, 244, 245, 268, 179, 192, 277, 205,
- 195, 127, 206, 202, 203, 207, 210, 227, 211, 223,
- 282, -117, 250, 277, 123, 270, -165, -138, 265, 266,
- 219, 281, 293, 110, 283, 284, 296, 291, 292, 294,
- 295, 44, 302, 271, 306, 246, 297, 234, 247, 81,
- 165, 248, 148, 236, 237, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 159, 85, 160, 51,
- 201, 303, 273, 261, 269, 274, 285, 75, 0, 0,
</del><ins>+ 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,
</ins><span class="cx"> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
</span><del>- 0, 0, 0, 0, 290, 110, 148, 148, 0, 0,
- 148, 148, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 148, 0, 0, 0, 0,
- 0, 0, 110, 0, 0, 0, 0, 0, 0, 0,
- 0, 148, 0, 0, 0, 148, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 131, 132, 133, 0,
- 134, 135, 136, 137, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
- 24, 25, 26, 138, 27, 28, 29, 30, 90, 31,
- 91, 92, 93, 0, 0, 94, 95, 0, 0, 0,
</del><ins>+ 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,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 189, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
+ 56, 57, 58, 59, 139, 60, 140, 141, 142, 143,
+ 0, 0, 0, 144, 145, 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, 96, 0, 0, 0, 139, 140,
- 0, 0, 0, 0, 141, 97, 98, 0, 99, 1,
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 131,
- 132, 133, 0, 134, 135, 136, 137, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 23, 24, 25, 26, 138, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
</del><ins>+ 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,
+ 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,
+ 189, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 0, 56, 57, 58, 59,
+ 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,
+ 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, 189, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 0, 56, 57, 58, 59, 139, 60, 140, 141,
+ 142, 143, 0, 0, 0, 144, 145, 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, 96, 0, 0,
- 0, 139, 221, 0, 0, 0, 0, 141, 97, 98,
- 0, 99, 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 131, 132, 133, 0, 134, 135, 136, 137,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 0, 0, 0, 23, 24, 25, 26, 138,
- 27, 28, 29, 30, 90, 31, 91, 92, 93, 0,
- 0, 94, 95, 0, 0, 0, 0, 0, 0, 0,
</del><ins>+ 0, 0, 0, 0, 146, 0, 0, 0, 190, 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, 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, 189, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 0, 56, 57,
+ 58, 59, 139, 60, 140, 141, 142, 143, 0, 0,
+ 0, 144, 145, 0, 0, 0, 0, 0, 0, 0,
</ins><span class="cx"> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
</span><del>- 96, 0, 0, 0, 139, 0, 0, 0, 0, 0,
- 141, 97, 98, 0, 99, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 131, 132, 133, 0, 134,
- 135, 136, 137, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 0, 0, 0, 23, 24,
- 25, 26, 138, 27, 28, 29, 30, 90, 31, 91,
- 92, 93, 0, 0, 94, 95, 0, 0, 0, 0,
</del><ins>+ 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,
+ 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, 189, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 0, 56, 57, 58, 59, 139, 60,
+ 140, 141, 142, 143, 0, 0, 0, 144, 145, 0,
</ins><span class="cx"> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
</span><del>- 0, 0, 0, 96, 0, 0, 0, 79, 0, 0,
- 0, 0, 0, 141, 97, 98, 0, 99, 1, 2,
- 3, 4, 5, 6, 7, 8, 9, 10, 131, 132,
- 133, 0, 134, 135, 136, 137, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 0, 0,
- 0, 23, 24, 25, 26, 138, 27, 28, 29, 30,
- 90, 31, 91, 92, 93, 0, 0, 94, 95, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 96, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 141, 97, 98, 0,
- 99, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 0, 0, 0, 0, 0, 0, 0, 0, 11,
</del><ins>+ 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,
+ 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, 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, 192, 147, 148, 0, 149, 0, 0, 0,
</ins><span class="cx"> 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
</span><del>- 22, 0, 0, 0, 23, 24, 25, 26, 0, 27,
- 28, 29, 30, 90, 31, 91, 92, 93, 0, 0,
- 94, 95, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 96,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 141,
- 97, 98, 0, 99, 60, 2, 3, 4, 0, 6,
- 7, 8, 9, 10, 0, 0, 0, 0, 0, 0,
- 0, 0, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 0, 0, 0, 23, 24, 25,
- 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
- 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
</del><ins>+ 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, 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,
+ 8, 9, 10, 11, 0, 0, 0, 0, 0, 0,
+ 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, 107, 60, 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, 108, 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, 0, 0, 0,
</ins><span class="cx"> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
</span><del>- 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
- 0, 0, 0, 97, 98, 0, 99, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
</del><ins>+ 0, 0, 0, 0, 146, 0, 0, 214, 8, 9,
+ 10, 11, 0, 0, 0, 147, 148, 0, 149, 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,
+ 0, 0, 0, 144, 145, 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, 96, 0, 0,
- 163, 8, 9, 10, 0, 0, 0, 0, 97, 98,
- 0, 99, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
- 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
- 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
</del><ins>+ 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,
</ins><span class="cx"> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
</span><del>- 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
- 0, 0, 208, 97, 98, 0, 99, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 0, 0, 25, 26, 0, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
</del><ins>+ 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,
+ 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, 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, 96, 0, 0,
- 224, 8, 9, 10, 0, 0, 0, 0, 97, 98,
- 0, 99, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 0, 0, 0, 0, 0, 25,
- 26, 0, 27, 28, 29, 30, 90, 31, 91, 92,
- 93, 0, 0, 94, 95, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 96, 0, 0, 0, 8, 9, 10, 0,
- 0, 0, 0, 97, 98, 0, 99, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 0,
- 0, 0, 0, 0, 25, 177, 0, 27, 28, 29,
- 30, 90, 31, 91, 92, 93, 0, 0, 94, 95,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 96, 2, 3,
- 4, 0, 0, 0, 8, 9, 10, 0, 97, 98,
- 0, 99, 0, 0, 0, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
- 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
- 31, 2, 3, 4, 0, 0, 0, 8, 9, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 199, 0, 0, 0, 0, 25, 26, 0, 27, 28,
- 29, 30, 0, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 74, 0, 0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 0, 0, 0, 0,
- 0, 0, 0, 253, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 0, 0, 0, 23,
- 24, 25, 26, 0, 27, 28, 29, 30, 0, 31,
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 0, 0, 0, 23, 24, 25, 26, 0, 27, 28,
- 29, 30, 0, 31, 2, 3, 4, 0, 0, 0,
- 8, 9, 10, 0, 0, 0, 0, 0, 0, 0,
- 0, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 0, 0, 0, 0, 0, 25, 26,
- 0, 27, 28, 29, 30, 0, 31, 8, 9, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 0, 0, 0, 0, 0, 25, 26, 0, 27, 28,
- 29, 30, 231, 232, 8, 9, 10, 0, 0, 0,
- 0, 0, 0, 0, 0, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 0, 0, 0,
- 0, 0, 25, 26, 0, 27, 28, 29, 30, 0,
- 31
</del><ins>+ 0, 0, 0, 0, 0, 146, 8, 9, 10, 11,
+ 0, 0, 0, 0, 0, 0, 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, 234, 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, 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,
+ 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, 293, 294, 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #define yypact_value_is_default(Yystate) \
</span><del>- (!!((Yystate) == (-261)))
</del><ins>+ (!!((Yystate) == (-309)))
</ins><span class="cx">
</span><span class="cx"> #define yytable_value_is_error(Yytable_value) \
</span><span class="cx"> YYID (0)
</span><span class="cx">
</span><span class="cx"> static const yytype_int16 yycheck[] =
</span><span class="cx"> {
</span><del>- 0, 25, 89, 88, 96, 57, 162, 73, 153, 128,
- 40, 0, 0, 256, 59, 39, 276, 37, 54, 55,
- 81, 108, 88, 73, 42, 45, 45, 46, 72, 260,
- 80, 72, 72, 51, 78, 65, 296, 78, 52, 53,
- 40, 36, 42, 67, 275, 137, 46, 77, 291, 94,
- 78, 51, 295, 89, 90, 85, 75, 46, 46, 73,
- 84, 73, 73, 77, 59, 65, 72, 72, 80, 45,
- 46, 78, 78, 78, 81, 162, 161, 77, 3, 79,
- 172, 75, 201, 8, 9, 85, 83, 78, 85, 176,
- 81, 3, 33, 34, 35, 161, 8, 9, 128, 37,
- 130, 78, 194, 78, 81, 73, 81, 71, 33, 34,
- 35, 36, 37, 71, 206, 73, 261, 4, 5, 6,
- 88, 33, 34, 35, 36, 37, 94, 95, 128, 75,
- 130, 218, 219, 61, 62, 63, 45, 46, 223, 86,
- 87, 297, 70, 111, 81, 56, 57, 72, 71, 173,
- 183, 184, 80, 153, 78, 79, 72, 223, 185, 186,
- 187, 188, 58, 189, 190, 250, 71, 60, 260, 71,
- 74, 201, 71, 81, 81, 81, 71, 74, 76, 73,
- 267, 71, 73, 275, 250, 40, 75, 71, 74, 74,
- 78, 74, 284, 161, 74, 71, 16, 72, 76, 81,
- 72, 201, 294, 255, 81, 191, 80, 173, 192, 59,
- 297, 193, 212, 181, 182, 183, 184, 185, 186, 187,
- 188, 189, 190, 191, 192, 193, 85, 66, 85, 5,
- 130, 295, 257, 212, 251, 257, 275, 46, -1, -1,
</del><ins>+ 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,
</ins><span class="cx"> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
</span><del>- -1, -1, -1, -1, 278, 223, 256, 257, -1, -1,
- 260, 261, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 275, -1, -1, -1, -1,
- -1, -1, 250, -1, -1, -1, -1, -1, -1, -1,
- -1, 291, -1, -1, -1, 295, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, -1,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, -1, -1, 52, 53, -1, -1, -1,
</del><ins>+ -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,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ -1, -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, -1, -1, 71, -1, -1, -1, 75, 76,
- -1, -1, -1, -1, 81, 82, 83, -1, 85, 3,
</del><ins>+ -1, -1, 104, -1, -1, -1, 108, 109, -1, -1,
+ -1, -1, 114, 115, 116, -1, 118, 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, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, -1, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, -1, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, -1, -1, -1, 85,
+ 86, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
+ -1, -1, 108, 109, -1, -1, -1, -1, 114, 115,
+ 116, -1, 118, 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, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, -1, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, -1, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, -1, -1, -1, 85, 86, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 104, -1, -1, -1, 108, -1,
+ -1, -1, -1, -1, 114, 115, 116, -1, 118, 3,
</ins><span class="cx"> 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
</span><del>- 14, 15, -1, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
</del><ins>+ 14, 15, 16, -1, 18, 19, 20, 21, -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, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, -1, 72, 73,
+ 74, 75, 76, 77, 78, 79, 80, 81, -1, -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, 71, -1, -1,
- -1, 75, 76, -1, -1, -1, -1, 81, 82, 83,
- -1, 85, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, -1, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, -1, -1, -1, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
- -1, 52, 53, -1, -1, -1, -1, -1, -1, -1,
</del><ins>+ 104, -1, -1, -1, 108, -1, -1, -1, -1, -1,
+ 114, 115, 116, -1, 118, 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, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, -1, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 70, -1, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, -1, -1, -1, 85, 86, -1,
</ins><span class="cx"> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
</span><del>- 71, -1, -1, -1, 75, -1, -1, -1, -1, -1,
- 81, 82, 83, -1, 85, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, -1, -1, -1, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, -1, -1, 52, 53, -1, -1, -1, -1,
</del><ins>+ -1, -1, -1, -1, -1, -1, 104, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 114, 115, 116, -1,
+ 118, 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, 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, 114, 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, 76, 77, 78, 79, 80, 81, -1, -1, -1,
+ 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 4, 5, 6, -1, -1, 104,
+ 10, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ 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, -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, 114, 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, -1, -1, -1,
</ins><span class="cx"> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
</span><del>- -1, -1, -1, 71, -1, -1, -1, 75, -1, -1,
- -1, -1, -1, 81, 82, 83, -1, 85, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, -1, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, -1, -1,
- -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, -1, -1, 52, 53, -1,
</del><ins>+ -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, 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, -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, 71, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 81, 82, 83, -1,
- 85, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, -1, -1, -1, -1, -1, -1, -1, -1, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, -1, -1, -1, 36, 37, 38, 39, -1, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, -1, -1,
- 52, 53, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 71,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 81,
- 82, 83, -1, 85, 3, 4, 5, 6, -1, 8,
- 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
- -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, -1, -1, -1, 36, 37, 38,
- 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
</del><ins>+ -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,
</ins><span class="cx"> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
</span><del>- -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
- -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
</del><ins>+ -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,
+ 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, -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, 71, -1, -1,
- 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
- -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
- 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
- -1, -1, 81, 82, 83, -1, 85, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 71, -1, -1,
- 74, 10, 11, 12, -1, -1, -1, -1, 82, 83,
- -1, 85, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, -1, -1, -1, -1, -1, 38,
- 39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, -1, -1, 52, 53, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 71, -1, -1, -1, 10, 11, 12, -1,
- -1, -1, -1, 82, 83, -1, 85, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, 39, -1, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, -1, -1, 52, 53,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 71, 4, 5,
- 6, -1, -1, -1, 10, 11, 12, -1, 82, 83,
- -1, 85, -1, -1, -1, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
- -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
- 46, 4, 5, 6, -1, -1, -1, 10, 11, 12,
- -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 76, -1, -1, -1, -1, 38, 39, -1, 41, 42,
- 43, 44, -1, 46, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 0, -1, -1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, -1, -1, -1, -1,
- -1, -1, -1, 76, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, -1, -1, -1, 36,
- 37, 38, 39, -1, 41, 42, 43, 44, -1, 46,
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- -1, -1, -1, 36, 37, 38, 39, -1, 41, 42,
- 43, 44, -1, 46, 4, 5, 6, -1, -1, -1,
- 10, 11, 12, -1, -1, -1, -1, -1, -1, -1,
- -1, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, -1, -1, -1, -1, -1, 38, 39,
- -1, 41, 42, 43, 44, -1, 46, 10, 11, 12,
- -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- -1, -1, -1, -1, -1, 38, 39, -1, 41, 42,
- 43, 44, 45, 46, 10, 11, 12, -1, -1, -1,
- -1, -1, -1, -1, -1, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, -1, -1, -1,
- -1, -1, 38, 39, -1, 41, 42, 43, 44, -1,
- 46
</del><ins>+ -1, -1, -1, -1, -1, 104, 10, 11, 12, 13,
+ -1, -1, -1, -1, -1, -1, 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, -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,
+ 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, 76, 77, 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
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
</span><span class="lines">@@ -1299,46 +1590,53 @@
</span><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><del>- 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 36, 37, 38, 39, 41, 42, 43,
- 44, 46, 126, 127, 128, 129, 130, 135, 136, 137,
- 138, 139, 140, 141, 142, 143, 175, 176, 177, 37,
- 45, 140, 45, 46, 75, 96, 81, 178, 72, 78,
- 3, 33, 34, 35, 132, 133, 138, 78, 81, 45,
- 96, 139, 141, 73, 0, 176, 141, 145, 75, 75,
- 161, 132, 131, 134, 139, 133, 96, 71, 73, 80,
- 45, 47, 48, 49, 52, 53, 71, 82, 83, 85,
- 97, 98, 99, 101, 102, 103, 104, 105, 106, 107,
- 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
- 118, 119, 120, 121, 125, 142, 81, 139, 146, 147,
- 144, 13, 14, 15, 17, 18, 19, 20, 40, 75,
- 76, 81, 108, 121, 122, 124, 126, 127, 142, 151,
- 152, 153, 154, 162, 163, 164, 167, 174, 96, 131,
- 134, 73, 80, 74, 125, 122, 150, 108, 108, 124,
- 52, 53, 73, 77, 72, 72, 78, 39, 122, 71,
- 108, 86, 87, 83, 85, 54, 55, 89, 90, 56,
- 57, 58, 60, 59, 94, 74, 96, 148, 149, 76,
- 147, 146, 81, 81, 169, 71, 71, 81, 81, 124,
- 71, 76, 155, 61, 62, 63, 70, 80, 123, 78,
- 81, 76, 152, 73, 74, 125, 150, 74, 72, 100,
- 124, 45, 46, 96, 103, 122, 108, 108, 110, 110,
- 112, 112, 112, 112, 113, 113, 117, 118, 119, 124,
- 73, 78, 81, 76, 158, 159, 160, 170, 124, 81,
- 168, 162, 122, 122, 125, 74, 74, 79, 125, 149,
- 40, 161, 153, 151, 163, 171, 72, 124, 137, 166,
- 156, 74, 122, 74, 71, 166, 172, 173, 158, 165,
- 96, 72, 76, 124, 81, 72, 16, 80, 153, 157,
- 161, 72, 124, 157, 158, 150, 81
</del><ins>+ 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 72, 73, 74, 75,
+ 77, 160, 161, 162, 163, 164, 169, 170, 171, 172,
+ 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,
+ 167, 173, 111, 114, 76, 129, 175, 76, 114, 159,
+ 176, 181, 175, 106, 0, 216, 181, 185, 108, 76,
+ 179, 180, 108, 201, 166, 165, 168, 176, 167, 129,
+ 104, 106, 113, 108, 3, 174, 176, 186, 187, 76,
+ 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
</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>+#define yyerrok                (yyerrstatus = 0)
+#define yyclearin        (yychar = YYEMPTY)
+#define YYEMPTY                (-2)
+#define YYEOF                0
</ins><span class="cx">
</span><del>-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
</del><ins>+#define YYACCEPT        goto yyacceptlab
+#define YYABORT                goto yyabortlab
+#define YYERROR                goto yyerrorlab
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> /* Like YYERROR except do call yyerror. This remains here temporarily
</span><span class="lines">@@ -1348,7 +1646,7 @@
</span><span class="cx"> in Bison 2.4.2's NEWS entry, where a plan to phase it out is
</span><span class="cx"> discussed. */
</span><span class="cx">
</span><del>-#define YYFAIL goto yyerrlab
</del><ins>+#define YYFAIL                goto yyerrlab
</ins><span class="cx"> #if defined YYFAIL
</span><span class="cx"> /* This is here to suppress warnings from the GCC cpp's
</span><span class="cx"> -Wunused-macros. Normally we don't worry about that warning, but
</span><span class="lines">@@ -1371,13 +1669,13 @@
</span><span class="cx"> else \
</span><span class="cx"> { \
</span><span class="cx"> yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \
</span><del>- YYERROR; \
- } \
</del><ins>+ YYERROR;                                                        \
+ }                                                                \
</ins><span class="cx"> while (YYID (0))
</span><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">@@ -1474,21 +1772,21 @@
</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; \
</del><ins>+# define YYDPRINTF(Args)                        \
+do {                                                \
+ if (yydebug)                                        \
+ YYFPRINTF Args;                                \
</ins><span class="cx"> } while (YYID (0))
</span><span class="cx">
</span><del>-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, Location, context); \
- YYFPRINTF (stderr, "\n"); \
- } \
</del><ins>+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                         \
+do {                                                                         \
+ if (yydebug)                                                                 \
+ {                                                                         \
+ YYFPRINTF (stderr, "%s ", Title);                                         \
+ yy_symbol_print (stderr,                                                 \
+                 Type, Value, Location, context); \
+ YYFPRINTF (stderr, "\n");                                                 \
+ }                                                                         \
</ins><span class="cx"> } while (YYID (0))
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1581,10 +1879,10 @@
</span><span class="cx"> YYFPRINTF (stderr, "\n");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
</del><ins>+# define YY_STACK_PRINT(Bottom, Top)                                \
+do {                                                                \
+ if (yydebug)                                                        \
+ yy_stack_print ((Bottom), (Top));                                \
</ins><span class="cx"> } while (YYID (0))
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1609,21 +1907,21 @@
</span><span class="cx"> int yyi;
</span><span class="cx"> unsigned long int yylno = yyrline[yyrule];
</span><span class="cx"> YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
</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 < yynrhs; yyi++)
</span><span class="cx"> {
</span><span class="cx"> YYFPRINTF (stderr, " $%d = ", yyi + 1);
</span><span class="cx"> yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
</span><del>- &(yyvsp[(yyi + 1) - (yynrhs)])
- , &(yylsp[(yyi + 1) - (yynrhs)]) , context);
</del><ins>+                 &(yyvsp[(yyi + 1) - (yynrhs)])
+                 , &(yylsp[(yyi + 1) - (yynrhs)])                 , context);
</ins><span class="cx"> YYFPRINTF (stderr, "\n");
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
</del><ins>+# define YY_REDUCE_PRINT(Rule)                \
+do {                                        \
+ if (yydebug)                                \
</ins><span class="cx"> yy_reduce_print (yyvsp, yylsp, Rule, context); \
</span><span class="cx"> } while (YYID (0))
</span><span class="cx">
</span><span class="lines">@@ -1639,7 +1937,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">@@ -1725,27 +2023,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 '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
</del><ins>+         case '"':
+         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">@@ -2082,26 +2380,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 &'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 &'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_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yyls1, yysize * sizeof (*yylsp),
- &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_("memory exhausted"),
+                 &yyss1, yysize * sizeof (*yyssp),
+                 &yyvs1, yysize * sizeof (*yyvsp),
+                 &yyls1, yysize * sizeof (*yylsp),
+                 &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">@@ -2109,23 +2407,23 @@
</span><span class="cx"> # else
</span><span class="cx"> /* Extend the stack our own way. */
</span><span class="cx"> if (YYMAXDEPTH <= yystacksize)
</span><del>- goto yyexhaustedlab;
</del><ins>+        goto yyexhaustedlab;
</ins><span class="cx"> yystacksize *= 2;
</span><span class="cx"> if (YYMAXDEPTH < 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">@@ -2135,10 +2433,10 @@
</span><span class="cx"> yylsp = yyls + yysize - 1;
</span><span class="cx">
</span><span class="cx"> YYDPRINTF ((stderr, "Stack size increased to %lu\n",
</span><del>- (unsigned long int) yystacksize));
</del><ins>+                 (unsigned long int) yystacksize));
</ins><span class="cx">
</span><span class="cx"> if (yyss + yystacksize - 1 <= yyssp)
</span><del>- YYABORT;
</del><ins>+        YYABORT;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> YYDPRINTF ((stderr, "Entering state %d\n", yystate));
</span><span class="lines">@@ -2267,7 +2565,7 @@
</span><span class="cx"> {
</span><span class="cx"> variable = static_cast<const TVariable*>(symbol);
</span><span class="cx">
</span><del>- if (context->symbolTable.findBuiltIn(variable->getName()) &&
</del><ins>+ if (context->symbolTable.findBuiltIn(variable->getName(), context->shaderVersion) &&
</ins><span class="cx"> !variable->getExtension().empty() &&
</span><span class="cx"> context->extensionErrorCheck((yylsp[(1) - (1)]), variable->getExtension()))
</span><span class="cx"> {
</span><span class="lines">@@ -2279,7 +2577,7 @@
</span><span class="cx"> {
</span><span class="cx"> TType type(EbtFloat, EbpUndefined);
</span><span class="cx"> TVariable *fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
</span><del>- context->symbolTable.insert(*fakeVariable);
</del><ins>+ context->symbolTable.declare(*fakeVariable);
</ins><span class="cx"> variable = fakeVariable;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2322,12 +2620,21 @@
</span><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> ConstantUnion *unionArray = new ConstantUnion[1];
</span><ins>+ unionArray->setUConst((yyvsp[(1) - (1)].lex).u);
+ (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 8:
+
+ {
+ ConstantUnion *unionArray = new ConstantUnion[1];
</ins><span class="cx"> unionArray->setFConst((yyvsp[(1) - (1)].lex).f);
</span><span class="cx"> (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 8:
</del><ins>+ case 9:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> ConstantUnion *unionArray = new ConstantUnion[1];
</span><span class="lines">@@ -2336,139 +2643,47 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 9:
</del><ins>+ case 10:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 10:
</del><ins>+ case 11:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 11:
</del><ins>+ case 12:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 12:
</del><ins>+ case 13:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 13:
</del><ins>+ case 14:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isArray()) {
- context->error((yylsp[(3) - (3)]), "cannot apply dot operator to an array", ".");
- context->recover();
- }
-
- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isVector()) {
- TVectorFields fields;
- if (! context->parseVectorFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) {
- fields.num = 1;
- fields.offsets[0] = 0;
- context->recover();
- }
-
- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { // constant folding for vector fields
- (yyval.interm.intermTypedNode) = context->addConstVectorNode(fields, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(3) - (3)]));
- if ((yyval.interm.intermTypedNode) == 0) {
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- else
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqConst, (int) (*(yyvsp[(3) - (3)].lex).string).size()));
- } else {
- TString vectorString = *(yyvsp[(3) - (3)].lex).string;
- TIntermTyped* index = context->intermediate.addSwizzle(fields, (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpVectorSwizzle, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (int) vectorString.size()));
- }
- } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->isMatrix()) {
- TMatrixFields fields;
- if (! context->parseMatrixFields(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize(), fields, (yylsp[(3) - (3)]))) {
- fields.wholeRow = false;
- fields.wholeCol = false;
- fields.row = 0;
- fields.col = 0;
- context->recover();
- }
-
- if (fields.wholeRow || fields.wholeCol) {
- context->error((yylsp[(2) - (3)]), " non-scalar fields not implemented yet", ".");
- context->recover();
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(0);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision(),EvqTemporary, (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize()));
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(fields.col * (yyvsp[(1) - (3)].interm.intermTypedNode)->getNominalSize() + fields.row);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirect, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (3)].interm.intermTypedNode)->getPrecision()));
- }
- } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) {
- bool fieldFound = false;
- const TFieldList& fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct()->fields();
- unsigned int i;
- for (i = 0; i < fields.size(); ++i) {
- if (fields[i]->name() == *(yyvsp[(3) - (3)].lex).string) {
- fieldFound = true;
- break;
- }
- }
- if (fieldFound) {
- if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) {
- (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
- if ((yyval.interm.intermTypedNode) == 0) {
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- else {
- (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
- // change the qualifier of the return type, not of the structure field
- // as the structure definition is shared between various structures.
- (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
- }
- } else {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(i);
- TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), (yylsp[(3) - (3)]));
- (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)]));
- (yyval.interm.intermTypedNode)->setType(*fields[i]->type());
- }
- } else {
- context->error((yylsp[(2) - (3)]), " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- } else {
- context->error((yylsp[(2) - (3)]), " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str());
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
- }
- // don't delete $3.string, it's from the pool
</del><ins>+ (yyval.interm.intermTypedNode) = context->addFieldSelectionExpression((yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yylsp[(3) - (3)]));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 14:
</del><ins>+ case 15:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->lValueErrorCheck((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)))
</span><span class="cx"> context->recover();
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->unaryOpError((yylsp[(2) - (2)]), "++", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2477,12 +2692,12 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 15:
</del><ins>+ case 16:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->lValueErrorCheck((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)))
</span><span class="cx"> context->recover();
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->unaryOpError((yylsp[(2) - (2)]), "--", (yyvsp[(1) - (2)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2491,7 +2706,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 16:
</del><ins>+ case 17:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"))
</span><span class="lines">@@ -2500,7 +2715,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 17:
</del><ins>+ case 18:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
</span><span class="lines">@@ -2534,7 +2749,7 @@
</span><span class="cx"> //
</span><span class="cx"> const TFunction* fnCandidate;
</span><span class="cx"> bool builtIn;
</span><del>- fnCandidate = context->findFunction((yylsp[(1) - (1)]), fnCall, &builtIn);
</del><ins>+ fnCandidate = context->findFunction((yylsp[(1) - (1)]), fnCall, context->shaderVersion, &builtIn);
</ins><span class="cx"> if (fnCandidate) {
</span><span class="cx"> //
</span><span class="cx"> // A declared function.
</span><span class="lines">@@ -2552,7 +2767,7 @@
</span><span class="cx"> //
</span><span class="cx"> // Treat it like a built-in unary operator.
</span><span class="cx"> //
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> std::stringstream extraInfoStream;
</span><span class="cx"> extraInfoStream << "built in unary operator function. Type: " << static_cast<TIntermTyped*>((yyvsp[(1) - (1)].interm).intermNode)->getCompleteString();
</span><span class="lines">@@ -2601,14 +2816,14 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 18:
</del><ins>+ case 19:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(1) - (1)].interm);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 19:
</del><ins>+ case 20:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> context->error((yylsp[(3) - (3)]), "methods are not supported", "");
</span><span class="lines">@@ -2617,21 +2832,21 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 20:
</del><ins>+ case 21:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(1) - (2)].interm);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 21:
</del><ins>+ case 22:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(1) - (2)].interm);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 22:
</del><ins>+ case 23:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
</span><span class="lines">@@ -2639,7 +2854,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 23:
</del><ins>+ case 24:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
</span><span class="lines">@@ -2647,7 +2862,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 24:
</del><ins>+ case 25:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()) };
</span><span class="lines">@@ -2657,7 +2872,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 25:
</del><ins>+ case 26:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()) };
</span><span class="lines">@@ -2667,73 +2882,21 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 26:
</del><ins>+ case 27:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 27:
</del><ins>+ case 28:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- //
- // Constructor
- //
- TOperator op = EOpNull;
- if ((yyvsp[(1) - (1)].interm.type).userDef) {
- op = EOpConstructStruct;
- } else {
- switch ((yyvsp[(1) - (1)].interm.type).type) {
- case EbtFloat:
- if ((yyvsp[(1) - (1)].interm.type).matrix) {
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 2: op = EOpConstructMat2; break;
- case 3: op = EOpConstructMat3; break;
- case 4: op = EOpConstructMat4; break;
- }
- } else {
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 1: op = EOpConstructFloat; break;
- case 2: op = EOpConstructVec2; break;
- case 3: op = EOpConstructVec3; break;
- case 4: op = EOpConstructVec4; break;
- }
- }
- break;
- case EbtInt:
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 1: op = EOpConstructInt; break;
- case 2: op = EOpConstructIVec2; break;
- case 3: op = EOpConstructIVec3; break;
- case 4: op = EOpConstructIVec4; break;
- }
- break;
- case EbtBool:
- switch((yyvsp[(1) - (1)].interm.type).size) {
- case 1: op = EOpConstructBool; break;
- case 2: op = EOpConstructBVec2; break;
- case 3: op = EOpConstructBVec3; break;
- case 4: op = EOpConstructBVec4; break;
- }
- break;
- default: break;
- }
- if (op == EOpNull) {
- context->error((yylsp[(1) - (1)]), "cannot construct this type", getBasicString((yyvsp[(1) - (1)].interm.type).type));
- context->recover();
- (yyvsp[(1) - (1)].interm.type).type = EbtFloat;
- op = EOpConstructFloat;
- }
- }
- TString tempString;
- TType type((yyvsp[(1) - (1)].interm.type));
- TFunction *function = new TFunction(&tempString, type, op);
- (yyval.interm.function) = function;
</del><ins>+ (yyval.interm.function) = context->addConstructorFunc((yyvsp[(1) - (1)].interm.type));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 28:
</del><ins>+ case 29:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
</span><span class="lines">@@ -2744,19 +2907,19 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 29:
</del><ins>+ case 30:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 30:
</del><ins>+ case 31:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->lValueErrorCheck((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)))
</span><span class="cx"> context->recover();
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->unaryOpError((yylsp[(1) - (2)]), "++", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2765,12 +2928,12 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 31:
</del><ins>+ case 32:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->lValueErrorCheck((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)))
</span><span class="cx"> context->recover();
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->unaryOpError((yylsp[(1) - (2)]), "--", (yyvsp[(2) - (2)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2779,11 +2942,11 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 32:
</del><ins>+ case 33:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> const char* errorOp = "";
</span><span class="cx"> switch((yyvsp[(1) - (2)].interm).op) {
</span><span class="lines">@@ -2800,30 +2963,30 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 33:
</del><ins>+ case 34:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpNull; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 34:
</del><ins>+ case 35:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpNegative; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 35:
</del><ins>+ case 36:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpLogicalNot; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 36:
</del><ins>+ case 37:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 37:
</del><ins>+ case 38:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2832,10 +2995,10 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 38:
</del><ins>+ case 39:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2844,15 +3007,15 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 39:
</del><ins>+ case 40:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 40:
</del><ins>+ case 41:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "+", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2861,10 +3024,10 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 41:
</del><ins>+ case 42:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "-", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2873,20 +3036,20 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 42:
</del><ins>+ case 43:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 43:
</del><ins>+ case 44:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 44:
</del><ins>+ case 45:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "<", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2897,10 +3060,10 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 45:
</del><ins>+ case 46:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), ">", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2911,10 +3074,10 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 46:
</del><ins>+ case 47:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "<=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2925,10 +3088,10 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 47:
</del><ins>+ case 48:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), ">=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2939,15 +3102,15 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 48:
</del><ins>+ case 49:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 49:
</del><ins>+ case 50:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "==", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2958,10 +3121,10 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 50:
</del><ins>+ case 51:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "!=", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -2972,11 +3135,6 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 51:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
- break;
-
</del><span class="cx"> case 52:
</span><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="lines">@@ -2994,8 +3152,13 @@
</span><span class="cx">
</span><span class="cx"> case 55:
</span><span class="cx">
</span><ins>+ { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
+ break;
+
+ case 56:
+
</ins><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "&&", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -3006,15 +3169,15 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 56:
</del><ins>+ case 57:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 57:
</del><ins>+ case 58:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "^^", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -3025,15 +3188,15 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 58:
</del><ins>+ case 59:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 59:
</del><ins>+ case 60:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
</del><ins>+ (yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</ins><span class="cx"> if ((yyval.interm.intermTypedNode) == 0) {
</span><span class="cx"> context->binaryOpError((yylsp[(2) - (3)]), "||", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -3044,12 +3207,12 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 60:
</del><ins>+ case 61:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 61:
</del><ins>+ case 62:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->boolErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.intermTypedNode)))
</span><span class="lines">@@ -3067,12 +3230,12 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 62:
</del><ins>+ case 63:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 63:
</del><ins>+ case 64:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->lValueErrorCheck((yylsp[(2) - (3)]), "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)))
</span><span class="lines">@@ -3086,39 +3249,39 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 64:
</del><ins>+ case 65:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpAssign; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 65:
</del><ins>+ case 66:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpMulAssign; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 66:
</del><ins>+ case 67:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpDivAssign; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 67:
</del><ins>+ case 68:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpAddAssign; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 68:
</del><ins>+ case 69:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm).op = EOpSubAssign; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 69:
</del><ins>+ case 70:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 70:
</del><ins>+ case 71:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</span><span class="lines">@@ -3130,7 +3293,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 71:
</del><ins>+ case 72:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
</span><span class="lines">@@ -3139,9 +3302,18 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 72:
</del><ins>+ case 73:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ if (context->enterStructDeclaration((yylsp[(1) - (2)]), *(yyvsp[(1) - (2)].lex).string))
+ context->recover();
+ (yyval.lex) = (yyvsp[(1) - (2)].lex);
+ }
+ break;
+
+ case 74:
+
+ {
</ins><span class="cx"> TFunction &function = *((yyvsp[(1) - (2)].interm).function);
</span><span class="cx">
</span><span class="cx"> TIntermAggregate *prototype = new TIntermAggregate;
</span><span class="lines">@@ -3170,7 +3342,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 73:
</del><ins>+ case 75:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if ((yyvsp[(1) - (2)].interm).intermAggregate)
</span><span class="lines">@@ -3179,7 +3351,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 74:
</del><ins>+ case 76:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
</span><span class="lines">@@ -3194,9 +3366,41 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 75:
</del><ins>+ case 77:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ ES3_ONLY(getQualifierString((yyvsp[(1) - (5)].interm.type).qualifier), (yylsp[(1) - (5)]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (5)].interm.type), (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].interm.fieldList), NULL, (yyloc), NULL, (yyloc));
+ }
+ break;
+
+ case 78:
+
+ {
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (6)].interm.type).qualifier), (yylsp[(1) - (6)]), "interface blocks");
+ (yyval.interm.intermNode) = context->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));
+ }
+ break;
+
+ case 79:
+
+ {
+ ES3_ONLY(getQualifierString((yyvsp[(1) - (9)].interm.type).qualifier), (yylsp[(1) - (9)]), "interface blocks");
+ (yyval.interm.intermNode) = context->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)]));
+ }
+ break;
+
+ case 80:
+
+ {
+ context->parseGlobalLayoutQualifier((yyvsp[(1) - (2)].interm.type));
+ (yyval.interm.intermNode) = 0;
+ }
+ break;
+
+ case 81:
+
+ {
</ins><span class="cx"> //
</span><span class="cx"> // Multiple declarations of the same function are allowed.
</span><span class="cx"> //
</span><span class="lines">@@ -3205,7 +3409,7 @@
</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<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName()));
</del><ins>+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getMangledName(), context->shaderVersion));
</ins><span class="cx"> if (prevDec) {
</span><span class="cx"> if (prevDec->getReturnType() != (yyvsp[(1) - (2)].interm.function)->getReturnType()) {
</span><span class="cx"> context->error((yylsp[(2) - (2)]), "overloaded functions must have the same return type", (yyvsp[(1) - (2)].interm.function)->getReturnType().getBasicString());
</span><span class="lines">@@ -3222,7 +3426,7 @@
</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->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getName());
</del><ins>+ TSymbol *prevSym = context->symbolTable.find((yyvsp[(1) - (2)].interm.function)->getName(), context->shaderVersion);
</ins><span class="cx"> if (prevSym)
</span><span class="cx"> {
</span><span class="cx"> if (!prevSym->isFunction())
</span><span class="lines">@@ -3250,21 +3454,21 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 76:
</del><ins>+ case 82:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 77:
</del><ins>+ case 83:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 78:
</del><ins>+ case 84:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> // Add the parameter
</span><span class="lines">@@ -3276,7 +3480,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 79:
</del><ins>+ case 85:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> //
</span><span class="lines">@@ -3298,7 +3502,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 80:
</del><ins>+ case 86:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
</span><span class="lines">@@ -3319,7 +3523,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 81:
</del><ins>+ case 87:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
</span><span class="lines">@@ -3333,7 +3537,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 82:
</del><ins>+ case 88:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> // Check that we can make an array out of this type
</span><span class="lines">@@ -3354,16 +3558,16 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 83:
</del><ins>+ case 89:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(3) - (3)].interm);
</span><del>- if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
</del><ins>+ if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
</ins><span class="cx"> context->recover();
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 84:
</del><ins>+ case 90:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(2) - (2)].interm);
</span><span class="lines">@@ -3374,16 +3578,16 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 85:
</del><ins>+ case 91:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(3) - (3)].interm);
</span><del>- if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.type).qualifier, (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
</del><ins>+ if (context->paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
</ins><span class="cx"> context->recover();
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 86:
</del><ins>+ case 92:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(2) - (2)].interm);
</span><span class="lines">@@ -3394,35 +3598,35 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 87:
</del><ins>+ case 93:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.qualifier) = EvqIn;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 88:
</del><ins>+ case 94:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.qualifier) = EvqIn;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 89:
</del><ins>+ case 95:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.qualifier) = EvqOut;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 90:
</del><ins>+ case 96:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.qualifier) = EvqInOut;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 91:
</del><ins>+ case 97:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
</span><span class="lines">@@ -3430,216 +3634,89 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 92:
</del><ins>+ case 98:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm) = (yyvsp[(1) - (1)].interm);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 93:
</del><ins>+ case 99:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if ((yyvsp[(1) - (3)].interm).type.type == EbtInvariant && !(yyvsp[(3) - (3)].lex).symbol)
- {
- context->error((yylsp[(3) - (3)]), "undeclared identifier declared as invariant", (yyvsp[(3) - (3)].lex).string->c_str());
- context->recover();
- }
-
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(3) - (3)].lex).string, TType((yyvsp[(1) - (3)].interm).type), (yylsp[(3) - (3)]));
- (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, symbol, (yylsp[(3) - (3)]));
-
- if (context->structQualifierErrorCheck((yylsp[(3) - (3)]), (yyval.interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, false))
- context->recover();
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck((yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyval.interm).type, variable))
- context->recover();
- if (symbol && variable)
- symbol->setId(variable->getUniqueId());
</del><ins>+ (yyval.interm) = (yyvsp[(1) - (3)].interm);
+ (yyval.interm).intermAggregate = context->parseDeclarator((yyval.interm).type, (yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].lex).symbol, (yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 94:
</del><ins>+ case 100:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, true))
- context->recover();
-
</del><span class="cx"> (yyval.interm) = (yyvsp[(1) - (5)].interm);
</span><del>-
- if (context->arrayTypeErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (5)]), (yyvsp[(1) - (5)].interm).type))
- context->recover();
- else {
- (yyvsp[(1) - (5)].interm).type.setArray(true);
- TVariable* variable;
- if (context->arrayErrorCheck((yylsp[(4) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, variable))
- context->recover();
- }
</del><ins>+ context->parseArrayDeclarator((yyval.interm).type, (yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yylsp[(4) - (5)]), NULL, NULL);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 95:
</del><ins>+ case 101:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if (context->structQualifierErrorCheck((yylsp[(3) - (6)]), (yyvsp[(1) - (6)].interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(3) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, true))
- context->recover();
-
</del><span class="cx"> (yyval.interm) = (yyvsp[(1) - (6)].interm);
</span><del>-
- if (context->arrayTypeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type) || context->arrayQualifierErrorCheck((yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).type))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck((yylsp[(4) - (6)]), (yyvsp[(5) - (6)].interm.intermTypedNode), size))
- context->recover();
- (yyvsp[(1) - (6)].interm).type.setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck((yylsp[(4) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, variable))
- context->recover();
- TType type = TType((yyvsp[(1) - (6)].interm).type);
- type.setArraySize(size);
- (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, context->intermediate.addSymbol(variable ? variable->getUniqueId() : 0, *(yyvsp[(3) - (6)].lex).string, type, (yylsp[(3) - (6)])), (yylsp[(3) - (6)]));
- }
</del><ins>+ (yyval.interm).intermAggregate = context->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));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 96:
</del><ins>+ case 102:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if (context->structQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm).type))
- context->recover();
-
</del><span class="cx"> (yyval.interm) = (yyvsp[(1) - (5)].interm);
</span><del>-
- TIntermNode* intermNode;
- if (!context->executeInitializer((yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, (yyvsp[(5) - (5)].interm.intermTypedNode), intermNode)) {
- //
- // build the intermediate representation
- //
- if (intermNode)
- (yyval.interm).intermAggregate = context->intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, intermNode, (yylsp[(4) - (5)]));
- else
- (yyval.interm).intermAggregate = (yyvsp[(1) - (5)].interm).intermAggregate;
- } else {
- context->recover();
- (yyval.interm).intermAggregate = 0;
- }
</del><ins>+ (yyval.interm).intermAggregate = context->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));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 97:
</del><ins>+ case 103:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
</span><del>- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(context->intermediate.addSymbol(0, "", TType((yyvsp[(1) - (1)].interm.type)), (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
</del><ins>+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(1) - (1)]), "");
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 98:
</del><ins>+ case 104:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyvsp[(1) - (2)].interm.type)), (yylsp[(2) - (2)]));
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (2)]));
-
- if (context->structQualifierErrorCheck((yylsp[(2) - (2)]), (yyval.interm).type))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, false))
- context->recover();
-
- (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
-
- TVariable* variable = 0;
- if (context->nonInitErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string, (yyval.interm).type, variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
</del><ins>+ (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 99:
</del><ins>+ case 105:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> context->error((yylsp[(2) - (4)]), "unsized array declarations not supported", (yyvsp[(2) - (4)].lex).string->c_str());
</span><span class="cx"> context->recover();
</span><span class="cx">
</span><del>- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (4)].lex).string, TType((yyvsp[(1) - (4)].interm.type)), (yylsp[(2) - (4)]));
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (4)]));
</del><span class="cx"> (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
</span><ins>+ (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 100:
</del><ins>+ case 106:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- TType type = TType((yyvsp[(1) - (5)].interm.type));
- int size;
- if (context->arraySizeErrorCheck((yylsp[(2) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
- context->recover();
- type.setArraySize(size);
- TIntermSymbol* symbol = context->intermediate.addSymbol(0, *(yyvsp[(2) - (5)].lex).string, type, (yylsp[(2) - (5)]));
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(symbol, (yylsp[(2) - (5)]));
-
- if (context->structQualifierErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.type)))
- context->recover();
-
- if (context->nonInitConstErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), true))
- context->recover();
-
</del><span class="cx"> (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
</span><del>-
- if (context->arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)) || context->arrayQualifierErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)))
- context->recover();
- else {
- int size;
- if (context->arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
- context->recover();
-
- (yyvsp[(1) - (5)].interm.type).setArray(true, size);
- TVariable* variable = 0;
- if (context->arrayErrorCheck((yylsp[(3) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), variable))
- context->recover();
- if (variable && symbol)
- symbol->setId(variable->getUniqueId());
- }
</del><ins>+ (yyval.interm).intermAggregate = context->parseSingleArrayDeclaration((yyval.interm).type, (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 101:
</del><ins>+ case 107:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if (context->structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
- context->recover();
-
</del><span class="cx"> (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
</span><del>-
- TIntermNode* intermNode;
- if (!context->executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode)) {
- //
- // Build intermediate representation
- //
- if(intermNode)
- (yyval.interm).intermAggregate = context->intermediate.makeAggregate(intermNode, (yylsp[(3) - (4)]));
- else
- (yyval.interm).intermAggregate = 0;
- } else {
- context->recover();
- (yyval.interm).intermAggregate = 0;
- }
</del><ins>+ (yyval.interm).intermAggregate = context->parseSingleInitDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yylsp[(3) - (4)]), (yyvsp[(4) - (4)].interm.intermTypedNode));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 102:
</del><ins>+ case 108:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> VERTEX_ONLY("invariant declaration", (yylsp[(1) - (2)]));
</span><span class="lines">@@ -3661,7 +3738,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 103:
</del><ins>+ case 109:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</span><span class="lines">@@ -3674,50 +3751,49 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 104:
</del><ins>+ case 110:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if ((yyvsp[(2) - (2)].interm.type).array) {
- context->error((yylsp[(2) - (2)]), "not supported", "first-class array");
- context->recover();
- (yyvsp[(2) - (2)].interm.type).setArray(false);
- }
</del><ins>+ (yyval.interm.type) = context->addFullySpecifiedType((yyvsp[(1) - (2)].interm.type).qualifier, (yyvsp[(1) - (2)].interm.type).layoutQualifier, (yyvsp[(2) - (2)].interm.type));
+ }
+ break;
</ins><span class="cx">
</span><del>- if ((yyvsp[(1) - (2)].interm.type).qualifier == EvqAttribute &&
- ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
- context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
- context->recover();
- }
- if (((yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingIn || (yyvsp[(1) - (2)].interm.type).qualifier == EvqVaryingOut) &&
- ((yyvsp[(2) - (2)].interm.type).type == EbtBool || (yyvsp[(2) - (2)].interm.type).type == EbtInt)) {
- context->error((yylsp[(2) - (2)]), "cannot be bool or int", getQualifierString((yyvsp[(1) - (2)].interm.type).qualifier));
- context->recover();
- }
- (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
- (yyval.interm.type).qualifier = (yyvsp[(1) - (2)].interm.type).qualifier;
</del><ins>+ case 111:
+
+ {
+ (yyval.interm.type).qualifier = EvqSmooth;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 105:
</del><ins>+ case 112:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.type).setBasic(EbtVoid, EvqConst, (yylsp[(1) - (1)]));
</del><ins>+ (yyval.interm.type).qualifier = EvqFlat;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 106:
</del><ins>+ case 113:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ (yyval.interm.qualifier) = EvqConst;
+ }
+ break;
+
+ case 114:
+
+ {
</ins><span class="cx"> VERTEX_ONLY("attribute", (yylsp[(1) - (1)]));
</span><ins>+ ES2_ONLY("attribute", (yylsp[(1) - (1)]));
</ins><span class="cx"> if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "attribute"))
</span><span class="cx"> context->recover();
</span><span class="cx"> (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[(1) - (1)]));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 107:
</del><ins>+ case 115:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ ES2_ONLY("varying", (yylsp[(1) - (1)]));
</ins><span class="cx"> if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying"))
</span><span class="cx"> context->recover();
</span><span class="cx"> if (context->shaderType == SH_VERTEX_SHADER)
</span><span class="lines">@@ -3727,9 +3803,10 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 108:
</del><ins>+ case 116:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ ES2_ONLY("varying", (yylsp[(1) - (2)]));
</ins><span class="cx"> if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
</span><span class="cx"> context->recover();
</span><span class="cx"> if (context->shaderType == SH_VERTEX_SHADER)
</span><span class="lines">@@ -3739,16 +3816,111 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 109:
</del><ins>+ case 117:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ if ((yyvsp[(1) - (1)].interm.type).qualifier != EvqConst && !context->symbolTable.atGlobalLevel()) {
+ context->error((yylsp[(1) - (1)]), "Local variables can only use the const storage qualifier.", getQualifierString((yyvsp[(1) - (1)].interm.type).qualifier));
+ context->recover();
+ } else {
+ (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yylsp[(1) - (1)]));
+ }
+ }
+ break;
+
+ case 118:
+
+ {
+ (yyval.interm.type) = context->joinInterpolationQualifiers((yylsp[(1) - (2)]), (yyvsp[(1) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]), (yyvsp[(2) - (2)].interm.type).qualifier);
+ }
+ break;
+
+ case 119:
+
+ {
+ context->error((yylsp[(1) - (1)]), "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getInterpolationString((yyvsp[(1) - (1)].interm.type).qualifier));
+ context->recover();
+
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 120:
+
+ {
+ (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier);
+ }
+ break;
+
+ case 121:
+
+ {
+ (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]));
+ (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
+ }
+ break;
+
+ case 122:
+
+ {
+ (yyval.interm.type).qualifier = EvqConst;
+ }
+ break;
+
+ case 123:
+
+ {
+ ES3_ONLY("in", (yylsp[(1) - (1)]), "storage qualifier");
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
+ }
+ break;
+
+ case 124:
+
+ {
+ ES3_ONLY("out", (yylsp[(1) - (1)]), "storage qualifier");
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
+ }
+ break;
+
+ case 125:
+
+ {
+ ES3_ONLY("centroid in", (yylsp[(1) - (2)]), "storage qualifier");
+ if (context->shaderType == SH_VERTEX_SHADER)
+ {
+ context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
+ context->recover();
+ }
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
+ }
+ break;
+
+ case 126:
+
+ {
+ ES3_ONLY("centroid out", (yylsp[(1) - (2)]), "storage qualifier");
+ if (context->shaderType == SH_FRAGMENT_SHADER)
+ {
+ context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
+ context->recover();
+ }
+ (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
+ }
+ break;
+
+ case 127:
+
+ {
</ins><span class="cx"> if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "uniform"))
</span><span class="cx"> context->recover();
</span><del>- (yyval.interm.type).setBasic(EbtVoid, EvqUniform, (yylsp[(1) - (1)]));
</del><ins>+ (yyval.interm.type).qualifier = EvqUniform;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 110:
</del><ins>+ case 128:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</span><span class="lines">@@ -3762,7 +3934,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 111:
</del><ins>+ case 129:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
</span><span class="lines">@@ -3770,35 +3942,78 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 112:
</del><ins>+ case 130:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.precision) = EbpHigh;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 113:
</del><ins>+ case 131:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.precision) = EbpMedium;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 114:
</del><ins>+ case 132:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.precision) = EbpLow;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 115:
</del><ins>+ case 133:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ ES3_ONLY("layout", (yylsp[(1) - (4)]), "qualifier");
+ (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
+ }
+ break;
+
+ case 134:
+
+ {
+ (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier);
+ }
+ break;
+
+ case 135:
+
+ {
+ (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier));
+ }
+ break;
+
+ case 136:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 137:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
+ }
+ break;
+
+ case 138:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
+ }
+ break;
+
+ case 139:
+
+ {
</ins><span class="cx"> (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 116:
</del><ins>+ case 140:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
</span><span class="lines">@@ -3814,7 +4029,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 117:
</del><ins>+ case 141:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3822,7 +4037,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 118:
</del><ins>+ case 142:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3830,7 +4045,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 119:
</del><ins>+ case 143:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3838,15 +4053,23 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 120:
</del><ins>+ case 144:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><ins>+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 145:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</ins><span class="cx"> (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 121:
</del><ins>+ case 146:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3855,7 +4078,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 122:
</del><ins>+ case 147:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3864,7 +4087,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 123:
</del><ins>+ case 148:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3873,7 +4096,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 124:
</del><ins>+ case 149:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3882,7 +4105,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 125:
</del><ins>+ case 150:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3891,7 +4114,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 126:
</del><ins>+ case 151:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3900,7 +4123,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 127:
</del><ins>+ case 152:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3909,7 +4132,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 128:
</del><ins>+ case 153:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3918,7 +4141,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 129:
</del><ins>+ case 154:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="lines">@@ -3927,52 +4150,237 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 130:
</del><ins>+ case 155:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><ins>+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setAggregate(2);
+ }
+ break;
+
+ case 156:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setAggregate(3);
+ }
+ break;
+
+ case 157:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setAggregate(4);
+ }
+ break;
+
+ case 158:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</ins><span class="cx"> (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</span><del>- (yyval.interm.type).setAggregate(2, true);
</del><ins>+ (yyval.interm.type).setMatrix(2, 2);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 131:
</del><ins>+ case 159:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</span><del>- (yyval.interm.type).setAggregate(3, true);
</del><ins>+ (yyval.interm.type).setMatrix(3, 3);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 132:
</del><ins>+ case 160:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx"> (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</span><del>- (yyval.interm.type).setAggregate(4, true);
</del><ins>+ (yyval.interm.type).setMatrix(4, 4);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 133:
</del><ins>+ case 161:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><ins>+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(2, 3);
+ }
+ break;
+
+ case 162:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(3, 2);
+ }
+ break;
+
+ case 163:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(2, 4);
+ }
+ break;
+
+ case 164:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(4, 2);
+ }
+ break;
+
+ case 165:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(3, 4);
+ }
+ break;
+
+ case 166:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
+ (yyval.interm.type).setMatrix(4, 3);
+ }
+ break;
+
+ case 167:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</ins><span class="cx"> (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[(1) - (1)]));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 134:
</del><ins>+ case 168:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><ins>+ (yyval.interm.type).setBasic(EbtSampler3D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 169:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</ins><span class="cx"> (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[(1) - (1)]));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 135:
</del><ins>+ case 170:
</ins><span class="cx">
</span><span class="cx"> {
</span><ins>+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 171:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISampler2D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 172:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISampler3D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 173:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 174:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 175:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 176:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 177:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 178:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 179:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 180:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 181:
+
+ {
+ TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+ (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yylsp[(1) - (1)]));
+ }
+ break;
+
+ case 182:
+
+ {
</ins><span class="cx"> if (!context->supportsExtension("GL_OES_EGL_image_external")) {
</span><span class="cx"> context->error((yylsp[(1) - (1)]), "unsupported type", "samplerExternalOES");
</span><span class="cx"> context->recover();
</span><span class="lines">@@ -3982,7 +4390,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 136:
</del><ins>+ case 183:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
</span><span class="lines">@@ -3994,7 +4402,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 137:
</del><ins>+ case 184:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</span><span class="lines">@@ -4002,7 +4410,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 138:
</del><ins>+ case 185:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> //
</span><span class="lines">@@ -4016,52 +4424,38 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 139:
</del><ins>+ case 186:
</ins><span class="cx">
</span><span class="cx"> { if (context->enterStructDeclaration((yylsp[(2) - (3)]), *(yyvsp[(2) - (3)].lex).string)) context->recover(); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 140:
</del><ins>+ case 187:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- if (context->reservedErrorCheck((yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string))
- context->recover();
-
- TType* structure = new TType(new TStructure((yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList)));
- TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
- if (! context->symbolTable.insert(*userTypeDef)) {
- context->error((yylsp[(2) - (6)]), "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
- context->recover();
- }
- (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (6)]));
- (yyval.interm.type).userDef = structure;
- context->exitStructDeclaration();
</del><ins>+ (yyval.interm.type) = context->addStructure((yylsp[(1) - (6)]), (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 141:
</del><ins>+ case 188:
</ins><span class="cx">
</span><span class="cx"> { if (context->enterStructDeclaration((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string)) context->recover(); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 142:
</del><ins>+ case 189:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- TType* structure = new TType(new TStructure(NewPoolTString(""), (yyvsp[(4) - (5)].interm.fieldList)));
- (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (5)]));
- (yyval.interm.type).userDef = structure;
- context->exitStructDeclaration();
</del><ins>+ (yyval.interm.type) = context->addStructure((yylsp[(1) - (5)]), (yyloc), NewPoolTString(""), (yyvsp[(4) - (5)].interm.fieldList));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 143:
</del><ins>+ case 190:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.fieldList) = (yyvsp[(1) - (1)].interm.fieldList);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 144:
</del><ins>+ case 191:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.fieldList) = (yyvsp[(1) - (2)].interm.fieldList);
</span><span class="lines">@@ -4078,41 +4472,24 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 145:
</del><ins>+ case 192:
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- (yyval.interm.fieldList) = (yyvsp[(2) - (3)].interm.fieldList);
</del><ins>+ (yyval.interm.fieldList) = context->addStructDeclaratorList((yyvsp[(1) - (3)].interm.type), (yyvsp[(2) - (3)].interm.fieldList));
+ }
+ break;
</ins><span class="cx">
</span><del>- if (context->voidErrorCheck((yylsp[(1) - (3)]), (*(yyvsp[(2) - (3)].interm.fieldList))[0]->name(), (yyvsp[(1) - (3)].interm.type))) {
- context->recover();
- }
- for (unsigned int i = 0; i < (yyval.interm.fieldList)->size(); ++i) {
- //
- // Careful not to replace already known aspects of type, like array-ness
- //
- TType* type = (*(yyval.interm.fieldList))[i]->type();
- type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
- type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
- type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
- type->setPrecision((yyvsp[(1) - (3)].interm.type).precision);
</del><ins>+ case 193:
</ins><span class="cx">
</span><del>- // don't allow arrays of arrays
- if (type->isArray()) {
- if (context->arrayTypeErrorCheck((yylsp[(1) - (3)]), (yyvsp[(1) - (3)].interm.type)))
- context->recover();
- }
- if ((yyvsp[(1) - (3)].interm.type).array)
- type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize);
- if ((yyvsp[(1) - (3)].interm.type).userDef)
- type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct());
-
- if (context->structNestingErrorCheck((yylsp[(1) - (3)]), *(*(yyval.interm.fieldList))[i]))
- context->recover();
- }
</del><ins>+ {
+ // ES3 Only, but errors should be handled elsewhere
+ (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->addStructDeclaratorList((yyvsp[(2) - (4)].interm.type), (yyvsp[(3) - (4)].interm.fieldList));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 146:
</del><ins>+ case 194:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.fieldList) = NewPoolTFieldList();
</span><span class="lines">@@ -4120,101 +4497,101 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 147:
</del><ins>+ case 195:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.fieldList)->push_back((yyvsp[(3) - (3)].interm.field));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 148:
</del><ins>+ case 196:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
</span><span class="cx"> context->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);
</del><ins>+ (yyval.interm.field) = new TField(type, (yyvsp[(1) - (1)].lex).string, (yylsp[(1) - (1)]));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 149:
</del><ins>+ case 197:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->reservedErrorCheck((yylsp[(1) - (4)]), *(yyvsp[(1) - (4)].lex).string))
</span><span class="cx"> context->recover();
</span><span class="cx">
</span><span class="cx"> TType* type = new TType(EbtVoid, EbpUndefined);
</span><del>- int size = 0;
</del><ins>+ int size;
</ins><span class="cx"> if (context->arraySizeErrorCheck((yylsp[(3) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
</span><span class="cx"> context->recover();
</span><span class="cx"> type->setArraySize(size);
</span><span class="cx">
</span><del>- (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string);
</del><ins>+ (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string, (yylsp[(1) - (4)]));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 150:
</del><ins>+ case 198:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 151:
</del><ins>+ case 199:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 152:
</del><ins>+ case 200:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 153:
</del><ins>+ case 201:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 154:
</del><ins>+ case 202:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 155:
</del><ins>+ case 203:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 156:
</del><ins>+ case 204:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 157:
</del><ins>+ case 205:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 158:
</del><ins>+ case 206:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 159:
</del><ins>+ case 207:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermAggregate) = 0; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 160:
</del><ins>+ case 208:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.push(); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 161:
</del><ins>+ case 209:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.pop(); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 162:
</del><ins>+ case 210:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
</span><span class="lines">@@ -4225,44 +4602,44 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 163:
</del><ins>+ case 211:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 164:
</del><ins>+ case 212:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 165:
</del><ins>+ case 213:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.push(); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 166:
</del><ins>+ case 214:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 167:
</del><ins>+ case 215:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.push(); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 168:
</del><ins>+ case 216:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 169:
</del><ins>+ case 217:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = 0;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 170:
</del><ins>+ case 218:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
</span><span class="lines">@@ -4273,31 +4650,31 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 171:
</del><ins>+ case 219:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), (yyloc));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 172:
</del><ins>+ case 220:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 173:
</del><ins>+ case 221:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = 0; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 174:
</del><ins>+ case 222:
</ins><span class="cx">
</span><span class="cx"> { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[(1) - (2)].interm.intermTypedNode)); }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 175:
</del><ins>+ case 223:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->boolErrorCheck((yylsp[(1) - (5)]), (yyvsp[(3) - (5)].interm.intermTypedNode)))
</span><span class="lines">@@ -4306,7 +4683,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 176:
</del><ins>+ case 224:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
</span><span class="lines">@@ -4314,7 +4691,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 177:
</del><ins>+ case 225:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
</span><span class="lines">@@ -4322,7 +4699,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 178:
</del><ins>+ case 226:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</span><span class="lines">@@ -4331,7 +4708,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 179:
</del><ins>+ case 227:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TIntermNode* intermNode;
</span><span class="lines">@@ -4349,12 +4726,12 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 180:
</del><ins>+ case 228:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.push(); ++context->loopNestingLevel; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 181:
</del><ins>+ case 229:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> context->symbolTable.pop();
</span><span class="lines">@@ -4363,12 +4740,12 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 182:
</del><ins>+ case 230:
</ins><span class="cx">
</span><span class="cx"> { ++context->loopNestingLevel; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 183:
</del><ins>+ case 231:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->boolErrorCheck((yylsp[(8) - (8)]), (yyvsp[(6) - (8)].interm.intermTypedNode)))
</span><span class="lines">@@ -4379,12 +4756,12 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 184:
</del><ins>+ case 232:
</ins><span class="cx">
</span><span class="cx"> { context->symbolTable.push(); ++context->loopNestingLevel; }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 185:
</del><ins>+ case 233:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> context->symbolTable.pop();
</span><span class="lines">@@ -4393,35 +4770,35 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 186:
</del><ins>+ case 234:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 187:
</del><ins>+ case 235:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 188:
</del><ins>+ case 236:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 189:
</del><ins>+ case 237:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermTypedNode) = 0;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 190:
</del><ins>+ case 238:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
</span><span class="lines">@@ -4429,7 +4806,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 191:
</del><ins>+ case 239:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
</span><span class="lines">@@ -4437,7 +4814,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 192:
</del><ins>+ case 240:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->loopNestingLevel <= 0) {
</span><span class="lines">@@ -4448,7 +4825,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 193:
</del><ins>+ case 241:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> if (context->loopNestingLevel <= 0) {
</span><span class="lines">@@ -4459,7 +4836,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 194:
</del><ins>+ case 242:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yylsp[(1) - (2)]));
</span><span class="lines">@@ -4470,7 +4847,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 195:
</del><ins>+ case 243:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = context->intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yylsp[(1) - (3)]));
</span><span class="lines">@@ -4485,7 +4862,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 196:
</del><ins>+ case 244:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> FRAG_ONLY("discard", (yylsp[(1) - (2)]));
</span><span class="lines">@@ -4493,7 +4870,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 197:
</del><ins>+ case 245:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</span><span class="lines">@@ -4501,7 +4878,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 198:
</del><ins>+ case 246:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
</span><span class="lines">@@ -4509,26 +4886,26 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 199:
</del><ins>+ case 247:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 200:
</del><ins>+ case 248:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 201:
</del><ins>+ case 249:
</ins><span class="cx">
</span><span class="cx"> {
</span><span class="cx"> TFunction* function = (yyvsp[(1) - (1)].interm).function;
</span><span class="cx">
</span><del>- const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName());
</del><ins>+ const TSymbol *builtIn = context->symbolTable.findBuiltIn(function->getMangledName(), context->shaderVersion);
</ins><span class="cx">
</span><span class="cx"> if (builtIn)
</span><span class="cx"> {
</span><span class="lines">@@ -4536,7 +4913,7 @@
</span><span class="cx"> context->recover();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName()));
</del><ins>+ TFunction* prevDec = static_cast<TFunction*>(context->symbolTable.find(function->getMangledName(), context->shaderVersion));
</ins><span class="cx"> //
</span><span class="cx"> // Note: 'prevDec' could be 'function' if this is the first time we've seen function
</span><span class="cx"> // as it would have just been put in the symbol table. Otherwise, we're looking up
</span><span class="lines">@@ -4587,7 +4964,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->symbolTable.insert(*variable)) {
</del><ins>+ if (! context->symbolTable.declare(*variable)) {
</ins><span class="cx"> context->error((yylsp[(1) - (1)]), "redefinition", variable->getName().c_str());
</span><span class="cx"> context->recover();
</span><span class="cx"> delete variable;
</span><span class="lines">@@ -4599,9 +4976,8 @@
</span><span class="cx"> paramNodes = context->intermediate.growAggregate(
</span><span class="cx"> paramNodes,
</span><span class="cx"> context->intermediate.addSymbol(variable->getUniqueId(),
</span><del>- variable->getName(),
- variable->getType(),
- (yylsp[(1) - (1)])),
</del><ins>+ variable->getName(),
+ variable->getType(), (yylsp[(1) - (1)])),
</ins><span class="cx"> (yylsp[(1) - (1)]));
</span><span class="cx"> } else {
</span><span class="cx"> paramNodes = context->intermediate.growAggregate(paramNodes, context->intermediate.addSymbol(0, "", *param.type, (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
</span><span class="lines">@@ -4613,7 +4989,7 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 202:
</del><ins>+ case 250:
</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="lines">@@ -4729,21 +5105,21 @@
</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 <= 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 ("Error: discarding",
- yytoken, &yylval, &yylloc, context);
- yychar = YYEMPTY;
</del><ins>+        {
+         yydestruct ("Error: discarding",
+                 yytoken, &yylval, &yylloc, context);
+         yychar = YYEMPTY;
+        }
</ins><span class="cx"> }
</span><del>- }
</del><span class="cx">
</span><span class="cx"> /* Else will try to reuse lookahead token after shifting the error
</span><span class="cx"> token. */
</span><span class="lines">@@ -4775,29 +5151,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 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
</del><ins>+        {
+         yyn += YYTERROR;
+         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+         {
+         yyn = yytable[yyn];
+         if (0 < 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 ("Error: popping",
</span><del>- yystos[yystate], yyvsp, yylsp, context);
</del><ins>+                 yystos[yystate], yyvsp, yylsp, 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">@@ -4860,7 +5236,7 @@
</span><span class="cx"> while (yyssp != yyss)
</span><span class="cx"> {
</span><span class="cx"> yydestruct ("Cleanup: popping",
</span><del>- yystos[*yyssp], yyvsp, yylsp, context);
</del><ins>+                 yystos[*yyssp], yyvsp, yylsp, context);
</ins><span class="cx"> YYPOPSTACK (1);
</span><span class="cx"> }
</span><span class="cx"> #ifndef yyoverflow
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_tabh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -46,7 +46,6 @@
</span><span class="cx">
</span><span class="cx"> #define YYLTYPE TSourceLoc
</span><span class="cx"> #define YYLTYPE_IS_DECLARED 1
</span><del>-#define SH_MAX_TOKEN_LENGTH 256 // WebGL spec.
</del><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -67,88 +66,121 @@
</span><span class="cx"> BOOL_TYPE = 265,
</span><span class="cx"> FLOAT_TYPE = 266,
</span><span class="cx"> INT_TYPE = 267,
</span><del>- BREAK = 268,
- CONTINUE = 269,
- DO = 270,
- ELSE = 271,
- FOR = 272,
- IF = 273,
- DISCARD = 274,
- RETURN = 275,
- BVEC2 = 276,
- BVEC3 = 277,
- BVEC4 = 278,
- IVEC2 = 279,
- IVEC3 = 280,
- IVEC4 = 281,
- VEC2 = 282,
- VEC3 = 283,
- VEC4 = 284,
- MATRIX2 = 285,
- MATRIX3 = 286,
- MATRIX4 = 287,
- IN_QUAL = 288,
- OUT_QUAL = 289,
- INOUT_QUAL = 290,
- UNIFORM = 291,
- VARYING = 292,
- STRUCT = 293,
- VOID_TYPE = 294,
- WHILE = 295,
- SAMPLER2D = 296,
- SAMPLERCUBE = 297,
- SAMPLER_EXTERNAL_OES = 298,
- SAMPLER2DRECT = 299,
- IDENTIFIER = 300,
- TYPE_NAME = 301,
- FLOATCONSTANT = 302,
- INTCONSTANT = 303,
- BOOLCONSTANT = 304,
- LEFT_OP = 305,
- RIGHT_OP = 306,
- INC_OP = 307,
- DEC_OP = 308,
- LE_OP = 309,
- GE_OP = 310,
- EQ_OP = 311,
- NE_OP = 312,
- AND_OP = 313,
- OR_OP = 314,
- XOR_OP = 315,
- MUL_ASSIGN = 316,
- DIV_ASSIGN = 317,
- ADD_ASSIGN = 318,
- MOD_ASSIGN = 319,
- LEFT_ASSIGN = 320,
- RIGHT_ASSIGN = 321,
- AND_ASSIGN = 322,
- XOR_ASSIGN = 323,
- OR_ASSIGN = 324,
- SUB_ASSIGN = 325,
- LEFT_PAREN = 326,
- RIGHT_PAREN = 327,
- LEFT_BRACKET = 328,
- RIGHT_BRACKET = 329,
- LEFT_BRACE = 330,
- RIGHT_BRACE = 331,
- DOT = 332,
- COMMA = 333,
- COLON = 334,
- EQUAL = 335,
- SEMICOLON = 336,
- BANG = 337,
- DASH = 338,
- TILDE = 339,
- PLUS = 340,
- STAR = 341,
- SLASH = 342,
- PERCENT = 343,
- LEFT_ANGLE = 344,
- RIGHT_ANGLE = 345,
- VERTICAL_BAR = 346,
- CARET = 347,
- AMPERSAND = 348,
- QUESTION = 349
</del><ins>+ 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"> };
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -163,6 +195,7 @@
</span><span class="cx"> TString *string;
</span><span class="cx"> float f;
</span><span class="cx"> int i;
</span><ins>+ unsigned int u;
</ins><span class="cx"> bool b;
</span><span class="cx"> };
</span><span class="cx"> TSymbol* symbol;
</span><span class="lines">@@ -178,6 +211,7 @@
</span><span class="cx"> union {
</span><span class="cx"> TPublicType type;
</span><span class="cx"> TPrecision precision;
</span><ins>+ TLayoutQualifier layoutQualifier;
</ins><span class="cx"> TQualifier qualifier;
</span><span class="cx"> TFunction* function;
</span><span class="cx"> TParameter param;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorintermOutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,10 +1,11 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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 "compiler/translator/localintermediate.h"
</span><ins>+#include "compiler/translator/SymbolTable.h"
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // Two purposes:
</span><span class="lines">@@ -43,10 +44,10 @@
</span><span class="cx"> stream << getQualifierString() << " " << getPrecisionString() << " ";
</span><span class="cx"> if (array)
</span><span class="cx"> stream << "array[" << getArraySize() << "] of ";
</span><del>- if (matrix)
- stream << static_cast<int>(size) << "X" << static_cast<int>(size) << " matrix of ";
- else if (size > 1)
- stream << static_cast<int>(size) << "-component vector of ";
</del><ins>+ if (isMatrix())
+ stream << getCols() << "X" << getRows() << " matrix of ";
+ else if (isVector())
+ stream << getNominalSize() << "-component vector of ";
</ins><span class="cx">
</span><span class="cx"> stream << getBasicString();
</span><span class="cx"> return stream.str();
</span><span class="lines">@@ -103,6 +104,7 @@
</span><span class="cx"> case EOpIndexDirect: out << "direct index"; break;
</span><span class="cx"> case EOpIndexIndirect: out << "indirect index"; break;
</span><span class="cx"> case EOpIndexDirectStruct: out << "direct index for structure"; break;
</span><ins>+ case EOpIndexDirectInterfaceBlock: out << "direct index for interface block"; break;
</ins><span class="cx"> case EOpVectorSwizzle: out << "vector swizzle"; break;
</span><span class="cx">
</span><span class="cx"> case EOpAdd: out << "add"; break;
</span><span class="lines">@@ -152,11 +154,16 @@
</span><span class="cx"> case EOpPreDecrement: out << "Pre-Decrement"; break;
</span><span class="cx">
</span><span class="cx"> case EOpConvIntToBool: out << "Convert int to bool"; break;
</span><ins>+ case EOpConvUIntToBool: out << "Convert uint to bool"; break;
</ins><span class="cx"> case EOpConvFloatToBool:out << "Convert float to bool";break;
</span><span class="cx"> case EOpConvBoolToFloat:out << "Convert bool to float";break;
</span><span class="cx"> case EOpConvIntToFloat: out << "Convert int to float"; break;
</span><ins>+ case EOpConvUIntToFloat:out << "Convert uint to float";break;
</ins><span class="cx"> case EOpConvFloatToInt: out << "Convert float to int"; break;
</span><span class="cx"> case EOpConvBoolToInt: out << "Convert bool to int"; break;
</span><ins>+ case EOpConvIntToUInt: out << "Convert int to uint"; break;
+ case EOpConvFloatToUInt:out << "Convert float to uint";break;
+ case EOpConvBoolToUInt: out << "Convert bool to uint"; break;
</ins><span class="cx">
</span><span class="cx"> case EOpRadians: out << "radians"; break;
</span><span class="cx"> case EOpDegrees: out << "degrees"; break;
</span><span class="lines">@@ -182,9 +189,9 @@
</span><span class="cx">
</span><span class="cx"> case EOpLength: out << "length"; break;
</span><span class="cx"> case EOpNormalize: out << "normalize"; break;
</span><del>- // case EOpDPdx: out << "dPdx"; break;
- // case EOpDPdy: out << "dPdy"; break;
- // case EOpFwidth: out << "fwidth"; break;
</del><ins>+ //        case EOpDPdx: out << "dPdx"; break;
+ //        case EOpDPdy: out << "dPdy"; break;
+ //        case EOpFwidth: out << "fwidth"; break;
</ins><span class="cx">
</span><span class="cx"> case EOpAny: out << "any"; break;
</span><span class="cx"> case EOpAll: out << "all"; break;
</span><span class="lines">@@ -232,6 +239,10 @@
</span><span class="cx"> case EOpConstructIVec2: out << "Construct ivec2"; break;
</span><span class="cx"> case EOpConstructIVec3: out << "Construct ivec3"; break;
</span><span class="cx"> case EOpConstructIVec4: out << "Construct ivec4"; break;
</span><ins>+ case EOpConstructUInt: out << "Construct uint"; break;
+ case EOpConstructUVec2: out << "Construct uvec2"; break;
+ case EOpConstructUVec3: out << "Construct uvec3"; break;
+ case EOpConstructUVec4: out << "Construct uvec4"; break;
</ins><span class="cx"> case EOpConstructMat2: out << "Construct mat2"; break;
</span><span class="cx"> case EOpConstructMat3: out << "Construct mat3"; break;
</span><span class="cx"> case EOpConstructMat4: out << "Construct mat4"; break;
</span><span class="lines">@@ -338,6 +349,10 @@
</span><span class="cx"> out << node->getUnionArrayPointer()[i].getIConst();
</span><span class="cx"> out << " (const int)\n";
</span><span class="cx"> break;
</span><ins>+ case EbtUInt:
+ out << node->getUnionArrayPointer()[i].getUConst();
+ out << " (const uint)\n";
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> out.message(EPrefixInternalError, node->getLine(), "Unknown constant");
</span><span class="cx"> break;
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorintermediateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermediate.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermediate.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermediate.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -19,6 +19,7 @@
</span><span class="cx"> #include "GLSLANG/ShaderLang.h"
</span><span class="cx">
</span><span class="cx"> #include <algorithm>
</span><ins>+#include <queue>
</ins><span class="cx"> #include "compiler/translator/Common.h"
</span><span class="cx"> #include "compiler/translator/Types.h"
</span><span class="cx"> #include "compiler/translator/ConstantUnion.h"
</span><span class="lines">@@ -50,11 +51,17 @@
</span><span class="cx"> EOpPreDecrement,
</span><span class="cx">
</span><span class="cx"> EOpConvIntToBool,
</span><ins>+ EOpConvUIntToBool,
</ins><span class="cx"> EOpConvFloatToBool,
</span><span class="cx"> EOpConvBoolToFloat,
</span><span class="cx"> EOpConvIntToFloat,
</span><ins>+ EOpConvUIntToFloat,
</ins><span class="cx"> EOpConvFloatToInt,
</span><span class="cx"> EOpConvBoolToInt,
</span><ins>+ EOpConvUIntToInt,
+ EOpConvIntToUInt,
+ EOpConvFloatToUInt,
+ EOpConvBoolToUInt,
</ins><span class="cx">
</span><span class="cx"> //
</span><span class="cx"> // binary operations
</span><span class="lines">@@ -86,6 +93,7 @@
</span><span class="cx"> EOpIndexDirect,
</span><span class="cx"> EOpIndexIndirect,
</span><span class="cx"> EOpIndexDirectStruct,
</span><ins>+ EOpIndexDirectInterfaceBlock,
</ins><span class="cx">
</span><span class="cx"> EOpVectorSwizzle,
</span><span class="cx">
</span><span class="lines">@@ -155,6 +163,7 @@
</span><span class="cx"> //
</span><span class="cx">
</span><span class="cx"> EOpConstructInt,
</span><ins>+ EOpConstructUInt,
</ins><span class="cx"> EOpConstructBool,
</span><span class="cx"> EOpConstructFloat,
</span><span class="cx"> EOpConstructVec2,
</span><span class="lines">@@ -166,6 +175,9 @@
</span><span class="cx"> EOpConstructIVec2,
</span><span class="cx"> EOpConstructIVec3,
</span><span class="cx"> EOpConstructIVec4,
</span><ins>+ EOpConstructUVec2,
+ EOpConstructUVec3,
+ EOpConstructUVec4,
</ins><span class="cx"> EOpConstructMat2,
</span><span class="cx"> EOpConstructMat3,
</span><span class="cx"> EOpConstructMat4,
</span><span class="lines">@@ -232,6 +244,10 @@
</span><span class="cx"> virtual bool replaceChildNode(
</span><span class="cx"> TIntermNode *original, TIntermNode *replacement) = 0;
</span><span class="cx">
</span><ins>+ // For traversing a tree in no particular order, but using
+ // heap memory.
+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const = 0;
+
</ins><span class="cx"> protected:
</span><span class="cx"> TSourceLoc line;
</span><span class="cx"> };
</span><span class="lines">@@ -261,18 +277,21 @@
</span><span class="cx"> TBasicType getBasicType() const { return type.getBasicType(); }
</span><span class="cx"> TQualifier getQualifier() const { return type.getQualifier(); }
</span><span class="cx"> TPrecision getPrecision() const { return type.getPrecision(); }
</span><ins>+ int getCols() const { return type.getCols(); }
+ int getRows() const { return type.getRows(); }
</ins><span class="cx"> int getNominalSize() const { return type.getNominalSize(); }
</span><ins>+ int getSecondarySize() const { return type.getSecondarySize(); }
</ins><span class="cx">
</span><ins>+ bool isInterfaceBlock() const { return type.isInterfaceBlock(); }
</ins><span class="cx"> bool isMatrix() const { return type.isMatrix(); }
</span><span class="cx"> bool isArray() const { return type.isArray(); }
</span><span class="cx"> bool isVector() const { return type.isVector(); }
</span><span class="cx"> bool isScalar() const { return type.isScalar(); }
</span><ins>+ bool isScalarInt() const { return type.isScalarInt(); }
</ins><span class="cx"> const char* getBasicString() const { return type.getBasicString(); }
</span><span class="cx"> const char* getQualifierString() const { return type.getQualifierString(); }
</span><span class="cx"> TString getCompleteString() const { return type.getCompleteString(); }
</span><span class="cx">
</span><del>- int totalRegisterCount() const { return type.totalRegisterCount(); }
- int elementRegisterCount() const { return type.elementRegisterCount(); }
</del><span class="cx"> int getArraySize() const { return type.getArraySize(); }
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="lines">@@ -314,6 +333,8 @@
</span><span class="cx"> void setUnrollFlag(bool flag) { unrollFlag = flag; }
</span><span class="cx"> bool getUnrollFlag() { return unrollFlag; }
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> TLoopType type;
</span><span class="cx"> TIntermNode* init; // for-loop initialization
</span><span class="lines">@@ -340,6 +361,8 @@
</span><span class="cx"> TOperator getFlowOp() { return flowOp; }
</span><span class="cx"> TIntermTyped* getExpression() { return expression; }
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> TOperator flowOp;
</span><span class="cx"> TIntermTyped* expression; // non-zero except for "return exp;" statements
</span><span class="lines">@@ -354,7 +377,7 @@
</span><span class="cx"> // per process globalpoolallocator, then it causes increased memory usage per compile
</span><span class="cx"> // it is essential to use "symbol = sym" to assign to symbol
</span><span class="cx"> TIntermSymbol(int i, const TString& sym, const TType& t) :
</span><del>- TIntermTyped(t), id(i) { symbol = sym; originalSymbol = sym; }
</del><ins>+ TIntermTyped(t), id(i) { symbol = sym; }
</ins><span class="cx">
</span><span class="cx"> virtual bool hasSideEffects() const { return false; }
</span><span class="cx">
</span><span class="lines">@@ -362,18 +385,16 @@
</span><span class="cx"> const TString& getSymbol() const { return symbol; }
</span><span class="cx">
</span><span class="cx"> void setId(int newId) { id = newId; }
</span><del>- void setSymbol(const TString& sym) { symbol = sym; }
</del><span class="cx">
</span><del>- const TString& getOriginalSymbol() const { return originalSymbol; }
-
</del><span class="cx"> virtual void traverse(TIntermTraverser*);
</span><span class="cx"> virtual TIntermSymbol* getAsSymbolNode() { return this; }
</span><span class="cx"> virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const {}
+
</ins><span class="cx"> protected:
</span><span class="cx"> int id;
</span><span class="cx"> TString symbol;
</span><del>- TString originalSymbol;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class TIntermConstantUnion : public TIntermTyped {
</span><span class="lines">@@ -385,6 +406,7 @@
</span><span class="cx"> ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
</span><span class="cx">
</span><span class="cx"> int getIConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
</span><ins>+ unsigned int getUConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getUConst() : 0; }
</ins><span class="cx"> float getFConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
</span><span class="cx"> bool getBConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
</span><span class="cx">
</span><span class="lines">@@ -394,6 +416,8 @@
</span><span class="cx">
</span><span class="cx"> TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const {}
+
</ins><span class="cx"> protected:
</span><span class="cx"> ConstantUnion *unionArrayPointer;
</span><span class="cx"> };
</span><span class="lines">@@ -440,6 +464,8 @@
</span><span class="cx"> void setAddIndexClamp() { addIndexClamp = true; }
</span><span class="cx"> bool getAddIndexClamp() { return addIndexClamp; }
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> TIntermTyped* left;
</span><span class="cx"> TIntermTyped* right;
</span><span class="lines">@@ -470,6 +496,8 @@
</span><span class="cx"> void setUseEmulatedFunction() { useEmulatedFunction = true; }
</span><span class="cx"> bool getUseEmulatedFunction() { return useEmulatedFunction; }
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> TIntermTyped* operand;
</span><span class="cx">
</span><span class="lines">@@ -514,6 +542,8 @@
</span><span class="cx"> void setUseEmulatedFunction() { useEmulatedFunction = true; }
</span><span class="cx"> bool getUseEmulatedFunction() { return useEmulatedFunction; }
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
</span><span class="cx"> TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
</span><span class="lines">@@ -552,6 +582,8 @@
</span><span class="cx"> TIntermNode* getFalseBlock() const { return falseBlock; }
</span><span class="cx"> TIntermSelection* getAsSelectionNode() { return this; }
</span><span class="cx">
</span><ins>+ virtual void enqueueChildren(std::queue<TIntermNode*> *nodeQueue) const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> TIntermTyped* condition;
</span><span class="cx"> TIntermNode* trueBlock;
</span><span class="lines">@@ -632,4 +664,30 @@
</span><span class="cx"> TVector<TIntermNode *> path;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+//
+// 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 < depthLimit; }
+};
+
</ins><span class="cx"> #endif // __INTERMEDIATE_H
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorlength_limitsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+//
+// Copyright (c) 2011-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.
+//
+
+//
+// length_limits.h
+//
+
+#if !defined(__LENGTH_LIMITS_H)
+#define __LENGTH_LIMITS_H 1
+
+#include "GLSLANG/ShaderLang.h"
+
+// These constants are factored out from the rest of the headers to
+// make it easier to reference them from the compiler sources.
+
+size_t GetGlobalMaxTokenSize(ShShaderSpec spec);
+
+#endif // !(defined(__LENGTH_LIMITS_H)
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorlocalintermediateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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,9 +7,7 @@
</span><span class="cx"> #ifndef _LOCAL_INTERMEDIATE_INCLUDED_
</span><span class="cx"> #define _LOCAL_INTERMEDIATE_INCLUDED_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
</del><span class="cx"> #include "compiler/translator/intermediate.h"
</span><del>-#include "compiler/translator/SymbolTable.h"
</del><span class="cx">
</span><span class="cx"> struct TVectorFields {
</span><span class="cx"> int offsets[4];
</span><span class="lines">@@ -27,10 +25,10 @@
</span><span class="cx">
</span><span class="cx"> TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TSourceLoc&);
</span><span class="cx"> TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
</span><del>- TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&, TSymbolTable&);
</del><ins>+ TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
</ins><span class="cx"> TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
</span><span class="cx"> TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&);
</span><del>- TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&, TSymbolTable&);
</del><ins>+ TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&);
</ins><span class="cx"> TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&);
</span><span class="cx"> TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&);
</span><span class="cx"> TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, const TSourceLoc&);
</span><span class="lines">@@ -39,13 +37,13 @@
</span><span class="cx"> TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
</span><span class="cx"> TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&);
</span><span class="cx"> TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
</span><del>- bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
</del><ins>+ bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TType, bool singleConstantParam = false);
</ins><span class="cx"> TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&);
</span><span class="cx"> TIntermBranch* addBranch(TOperator, const TSourceLoc&);
</span><span class="cx"> TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
</span><span class="cx"> TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&);
</span><span class="cx"> bool postProcess(TIntermNode*);
</span><del>- void remove(TIntermNode*);
</del><ins>+        void remove(TIntermNode*);
</ins><span class="cx"> void outputTree(TIntermNode*);
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorossource_wincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -19,39 +19,39 @@
</span><span class="cx"> //
</span><span class="cx"> OS_TLSIndex OS_AllocTLSIndex()
</span><span class="cx"> {
</span><del>- DWORD dwIndex = TlsAlloc();
- if (dwIndex == TLS_OUT_OF_INDEXES) {
- assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
- return OS_INVALID_TLS_INDEX;
- }
</del><ins>+        DWORD dwIndex = TlsAlloc();
+        if (dwIndex == TLS_OUT_OF_INDEXES) {
+                assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
+                return OS_INVALID_TLS_INDEX;
+        }
</ins><span class="cx">
</span><del>- return dwIndex;
</del><ins>+        return dwIndex;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
</span><span class="cx"> {
</span><del>- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
</del><ins>+        if (nIndex == OS_INVALID_TLS_INDEX) {
+                assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
+                return false;
+        }
</ins><span class="cx">
</span><del>- if (TlsSetValue(nIndex, lpvValue))
- return true;
- else
- return false;
</del><ins>+        if (TlsSetValue(nIndex, lpvValue))
+                return true;
+        else
+                return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
</span><span class="cx"> {
</span><del>- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
</del><ins>+        if (nIndex == OS_INVALID_TLS_INDEX) {
+                assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
+                return false;
+        }
</ins><span class="cx">
</span><del>- if (TlsFree(nIndex))
- return true;
- else
- return false;
</del><ins>+        if (TlsFree(nIndex))
+                return true;
+        else
+                return false;
</ins><span class="cx"> }
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorparseConstcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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,7 +12,7 @@
</span><span class="cx"> //
</span><span class="cx"> class TConstTraverser : public TIntermTraverser {
</span><span class="cx"> public:
</span><del>- TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType& t)
</del><ins>+ TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TType& t)
</ins><span class="cx"> : error(false),
</span><span class="cx"> index(0),
</span><span class="cx"> unionArray(cUnion),
</span><span class="lines">@@ -20,10 +20,10 @@
</span><span class="cx"> constructorType(constructType),
</span><span class="cx"> singleConstantParam(singleConstParam),
</span><span class="cx"> infoSink(sink),
</span><del>- symbolTable(symTable),
</del><span class="cx"> size(0),
</span><del>- isMatrix(false),
- matrixSize(0) {
</del><ins>+ isDiagonalMatrixInit(false),
+ matrixCols(0),
+ matrixRows(0) {
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool error;
</span><span class="lines">@@ -44,10 +44,10 @@
</span><span class="cx"> TOperator constructorType;
</span><span class="cx"> bool singleConstantParam;
</span><span class="cx"> TInfoSink& infoSink;
</span><del>- TSymbolTable& symbolTable;
</del><span class="cx"> size_t size; // size of the constructor ( 4 for vec4)
</span><del>- bool isMatrix;
- size_t matrixSize; // dimension of the matrix (nominal size and not the instance size)
</del><ins>+ bool isDiagonalMatrixInit;
+ int matrixCols; // columns of the matrix
+ int matrixRows; // rows of the matrix
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -118,8 +118,9 @@
</span><span class="cx"> size = node->getType().getObjectSize();
</span><span class="cx">
</span><span class="cx"> if (node->getType().isMatrix()) {
</span><del>- isMatrix = true;
- matrixSize = node->getType().getNominalSize();
</del><ins>+ isDiagonalMatrixInit = true;
+ matrixCols = node->getType().getCols();
+ matrixRows = node->getType().getRows();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -136,8 +137,9 @@
</span><span class="cx"> singleConstantParam = false;
</span><span class="cx"> constructorType = EOpNull;
</span><span class="cx"> size = 0;
</span><del>- isMatrix = false;
- matrixSize = 0;
</del><ins>+ isDiagonalMatrixInit = false;
+ matrixCols = 0;
+ matrixRows = 0;
</ins><span class="cx"> }
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -165,10 +167,10 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!singleConstantParam) {
</span><del>- size_t size = node->getType().getObjectSize();
</del><ins>+ size_t objectSize = node->getType().getObjectSize();
</ins><span class="cx">
</span><span class="cx"> ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
</span><del>- for (size_t i = 0; i < size; i++) {
</del><ins>+ for (size_t i=0; i < objectSize; i++) {
</ins><span class="cx"> if (index >= instanceSize)
</span><span class="cx"> return;
</span><span class="cx"> leftUnionArray[index] = rightUnionArray[i];
</span><span class="lines">@@ -178,8 +180,8 @@
</span><span class="cx"> } else {
</span><span class="cx"> size_t totalSize = index + size;
</span><span class="cx"> ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
</span><del>- if (!isMatrix) {
- size_t count = 0;
</del><ins>+ if (!isDiagonalMatrixInit) {
+ int count = 0;
</ins><span class="cx"> for (size_t i = index; i < totalSize; i++) {
</span><span class="cx"> if (i >= instanceSize)
</span><span class="cx"> return;
</span><span class="lines">@@ -191,21 +193,25 @@
</span><span class="cx"> if (node->getType().getObjectSize() > 1)
</span><span class="cx"> count++;
</span><span class="cx"> }
</span><del>- } else { // for matrix constructors
- size_t count = 0;
- size_t element = index;
- for (size_t i = index; i < totalSize; i++) {
- if (i >= instanceSize)
- return;
- if (element - i == 0 || (i - element) % (matrixSize + 1) == 0 )
- leftUnionArray[i] = rightUnionArray[count];
- else
- leftUnionArray[i].setFConst(0.0f);
</del><ins>+ }
+ else
+ {
+ // for matrix diagonal constructors from a single scalar
+ for (int i = 0, col = 0; col < matrixCols; col++)
+ {
+ for (int row = 0; row < matrixRows; row++, i++)
+ {
+ if (col == row)
+ {
+ leftUnionArray[i] = rightUnionArray[0];
+ }
+ else
+ {
+ leftUnionArray[i].setFConst(0.0f);
+ }
</ins><span class="cx">
</span><del>- (index)++;
-
- if (node->getType().getObjectSize() > 1)
- count++;
</del><ins>+ (index)++;
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -230,12 +236,12 @@
</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& line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam)
</del><ins>+bool TIntermediate::parseConstTree(const TSourceLoc& line, TIntermNode* root, ConstantUnion* 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, symbolTable, t);
</del><ins>+ TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, t);
</ins><span class="cx">
</span><span class="cx"> root->traverse(&it);
</span><span class="cx"> if (it.error)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictFragmentShaderTimingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -31,6 +31,15 @@
</span><span class="cx"> mSamplingOps.insert("texture2DRect(1;vf2;");
</span><span class="cx"> mSamplingOps.insert("texture2DRectProj(1;vf3;");
</span><span class="cx"> mSamplingOps.insert("texture2DRectProj(1;vf4;");
</span><ins>+ // Sampling ops provided by EXT_shader_texture_lod.
+ mSamplingOps.insert("texture2DLodEXT(1;vf2;f1;");
+ mSamplingOps.insert("texture2DProjLodEXT(1;vf3;f1;");
+ mSamplingOps.insert("texture2DProjLodEXT(1;vf4;f1;");
+ mSamplingOps.insert("textureCubeLodEXT(1;vf4;f1;");
+ mSamplingOps.insert("texture2DGradEXT(1;vf2;vf2;vf2;");
+ mSamplingOps.insert("texture2DProjGradEXT(1;vf3;vf2;vf2;");
+ mSamplingOps.insert("texture2DProjGradEXT(1;vf4;vf2;vf2;");
+ mSamplingOps.insert("textureCubeGradEXT(1;vf3;vf3;vf3;");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // FIXME(mvujovic): We do not know if the execution time of built-in operations like sin, pow, etc.
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictFragmentShaderTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,8 +7,6 @@
</span><span class="cx"> #ifndef COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
</span><span class="cx"> #define COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
-
</del><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx"> #include "compiler/translator/depgraph/DependencyGraph.h"
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictVertexShaderTimingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,6 +12,6 @@
</span><span class="cx"> ++mNumErrors;
</span><span class="cx"> mSink.message(EPrefixError,
</span><span class="cx"> node->getLine(),
</span><del>- "Samplers are not permitted in vertex shaders");
</del><ins>+ "Samplers are not permitted in vertex shaders.\n");
</ins><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictVertexShaderTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,8 +7,6 @@
</span><span class="cx"> #ifndef COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
</span><span class="cx"> #define COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
-
</del><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx"> #include "compiler/translator/InfoSink.h"
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLConfigcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,8 +13,11 @@
</span><span class="cx"> #include <algorithm>
</span><span class="cx"> #include <vector>
</span><span class="cx">
</span><ins>+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx"> #include <GLES2/gl2ext.h>
</span><ins>+#include <EGL/eglext.h>
</ins><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><span class="cx">
</span><span class="lines">@@ -36,6 +39,13 @@
</span><span class="cx"> mBlueSize = 5;
</span><span class="cx"> mAlphaSize = 1;
</span><span class="cx"> break;
</span><ins>+ case GL_BGR5_A1_ANGLEX:
+ mBufferSize = 16;
+ mRedSize = 5;
+ mGreenSize = 5;
+ mBlueSize = 5;
+ mAlphaSize = 1;
+ break;
</ins><span class="cx"> case GL_RGBA8_OES:
</span><span class="cx"> mBufferSize = 32;
</span><span class="cx"> mRedSize = 8;
</span><span class="lines">@@ -122,6 +132,12 @@
</span><span class="cx"> mTransparentRedValue = 0;
</span><span class="cx"> mTransparentGreenValue = 0;
</span><span class="cx"> mTransparentBlueValue = 0;
</span><ins>+
+ if (desc.es3Capable)
+ {
+ mRenderableType |= EGL_OPENGL_ES3_BIT_KHR;
+ mConformant |= EGL_OPENGL_ES3_BIT_KHR;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> EGLConfig Config::getHandle() const
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLDisplaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> #include <vector>
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><del>-#include "libGLESv2/mathutil.h"
</del><ins>+#include "common/mathutil.h"
</ins><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx"> #include "libGLESv2/Context.h"
</span><span class="cx"> #include "libGLESv2/renderer/SwapChain.h"
</span><span class="lines">@@ -191,6 +191,10 @@
</span><span class="cx"> const Config *configuration = mConfigSet.get(config);
</span><span class="cx"> EGLint postSubBufferSupported = EGL_FALSE;
</span><span class="cx">
</span><ins>+ EGLint width = 0;
+ EGLint height = 0;
+ EGLint fixedSize = EGL_FALSE;
+
</ins><span class="cx"> if (attribList)
</span><span class="cx"> {
</span><span class="cx"> while (*attribList != EGL_NONE)
</span><span class="lines">@@ -211,6 +215,15 @@
</span><span class="cx"> case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
</span><span class="cx"> postSubBufferSupported = attribList[1];
</span><span class="cx"> break;
</span><ins>+ case EGL_WIDTH:
+ width = attribList[1];
+ break;
+ case EGL_HEIGHT:
+ height = attribList[1];
+ break;
+ case EGL_FIXED_SIZE_ANGLE:
+ fixedSize = attribList[1];
+ break;
</ins><span class="cx"> case EGL_VG_COLORSPACE:
</span><span class="cx"> return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
</span><span class="cx"> case EGL_VG_ALPHA_FORMAT:
</span><span class="lines">@@ -223,6 +236,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (width < 0 || height < 0)
+ {
+ return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
+ }
+
+ if (!fixedSize)
+ {
+ width = -1;
+ height = -1;
+ }
+
</ins><span class="cx"> if (hasExistingWindowSurface(window))
</span><span class="cx"> {
</span><span class="cx"> return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
</span><span class="lines">@@ -234,7 +258,7 @@
</span><span class="cx"> return EGL_NO_SURFACE;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Surface *surface = new Surface(this, configuration, window, postSubBufferSupported);
</del><ins>+ Surface *surface = new Surface(this, configuration, window, fixedSize, width, height, postSubBufferSupported);
</ins><span class="cx">
</span><span class="cx"> if (!surface->initialize())
</span><span class="cx"> {
</span><span class="lines">@@ -360,22 +384,29 @@
</span><span class="cx"> return success(surface);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
</del><ins>+EGLContext Display::createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
</ins><span class="cx"> {
</span><span class="cx"> if (!mRenderer)
</span><span class="cx"> {
</span><del>- return NULL;
</del><ins>+ return EGL_NO_CONTEXT;
</ins><span class="cx"> }
</span><span class="cx"> else if (mRenderer->testDeviceLost(false)) // Lost device
</span><span class="cx"> {
</span><span class="cx"> if (!restoreLostDevice())
</span><del>- return NULL;
</del><ins>+ {
+ return error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Context *context = glCreateContext(shareContext, mRenderer, notifyResets, robustAccess);
</del><ins>+ if (clientVersion > 2 && mRenderer->getMajorShaderModel() < 4)
+ {
+ return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
+ }
+
+ gl::Context *context = glCreateContext(clientVersion, shareContext, mRenderer, notifyResets, robustAccess);
</ins><span class="cx"> mContextSet.insert(context);
</span><span class="cx">
</span><del>- return context;
</del><ins>+ return success(context);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Display::restoreLostDevice()
</span><span class="lines">@@ -487,6 +518,8 @@
</span><span class="cx">
</span><span class="cx"> mExtensionString += "EGL_ANGLE_query_surface_pointer ";
</span><span class="cx">
</span><ins>+ mExtensionString += "EGL_ANGLE_window_fixed_size ";
+
</ins><span class="cx"> if (swiftShader)
</span><span class="cx"> {
</span><span class="cx"> mExtensionString += "EGL_ANGLE_software_display ";
</span><span class="lines">@@ -499,9 +532,12 @@
</span><span class="cx">
</span><span class="cx"> if (mRenderer->getPostSubBufferSupport())
</span><span class="cx"> {
</span><del>- mExtensionString += "EGL_NV_post_sub_buffer";
</del><ins>+ mExtensionString += "EGL_NV_post_sub_buffer ";
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ // TODO: complete support for the EGL_KHR_create_context extension
+ mExtensionString += "EGL_KHR_create_context ";
+
</ins><span class="cx"> std::string::size_type end = mExtensionString.find_last_not_of(' ');
</span><span class="cx"> if (end != std::string::npos)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLDisplayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">
</span><span class="cx"> EGLSurface createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList);
</span><span class="cx"> EGLSurface createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList);
</span><del>- EGLContext createContext(EGLConfig configHandle, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
</del><ins>+ EGLContext createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, bool robustAccess);
</ins><span class="cx">
</span><span class="cx"> void destroySurface(egl::Surface *surface);
</span><span class="cx"> void destroyContext(gl::Context *context);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLSurfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> namespace egl
</span><span class="cx"> {
</span><span class="cx">
</span><del>-Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
</del><ins>+Surface::Surface(Display *display, const Config *config, HWND window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported)
</ins><span class="cx"> : mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
</span><span class="cx"> {
</span><span class="cx"> mRenderer = mDisplay->getRenderer();
</span><span class="lines">@@ -39,9 +39,10 @@
</span><span class="cx"> mRenderBuffer = EGL_BACK_BUFFER;
</span><span class="cx"> mSwapBehavior = EGL_BUFFER_PRESERVED;
</span><span class="cx"> mSwapInterval = -1;
</span><del>- mWidth = -1;
- mHeight = -1;
</del><ins>+ mWidth = width;
+ mHeight = height;
</ins><span class="cx"> setSwapInterval(1);
</span><ins>+ mFixedSize = fixedSize;
</ins><span class="cx">
</span><span class="cx"> subclassWindow();
</span><span class="cx"> }
</span><span class="lines">@@ -61,6 +62,8 @@
</span><span class="cx"> mSwapBehavior = EGL_BUFFER_PRESERVED;
</span><span class="cx"> mSwapInterval = -1;
</span><span class="cx"> setSwapInterval(1);
</span><ins>+ // This constructor is for offscreen surfaces, which are always fixed-size.
+ mFixedSize = EGL_TRUE;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Surface::~Surface()
</span><span class="lines">@@ -96,7 +99,7 @@
</span><span class="cx"> int width;
</span><span class="cx"> int height;
</span><span class="cx">
</span><del>- if (mWindow)
</del><ins>+ if (!mFixedSize)
</ins><span class="cx"> {
</span><span class="cx"> RECT windowRect;
</span><span class="cx"> if (!GetClientRect(getWindowHandle(), &windowRect))
</span><span class="lines">@@ -140,7 +143,7 @@
</span><span class="cx"> ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
</span><span class="cx"> ASSERT(mSwapChain);
</span><span class="cx">
</span><del>- EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight);
</del><ins>+ EGLint status = mSwapChain->resize(std::max(1, backbufferWidth), std::max(1, backbufferHeight));
</ins><span class="cx">
</span><span class="cx"> if (status == EGL_CONTEXT_LOST)
</span><span class="cx"> {
</span><span class="lines">@@ -163,7 +166,7 @@
</span><span class="cx"> ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
</span><span class="cx"> ASSERT(mSwapChain);
</span><span class="cx">
</span><del>- EGLint status = mSwapChain->reset(backbufferWidth, backbufferHeight, mSwapInterval);
</del><ins>+ EGLint status = mSwapChain->reset(std::max(1, backbufferWidth), std::max(1, backbufferHeight), mSwapInterval);
</ins><span class="cx">
</span><span class="cx"> if (status == EGL_CONTEXT_LOST)
</span><span class="cx"> {
</span><span class="lines">@@ -300,22 +303,23 @@
</span><span class="cx"> bool Surface::checkForOutOfDateSwapChain()
</span><span class="cx"> {
</span><span class="cx"> RECT client;
</span><del>- if (!GetClientRect(getWindowHandle(), &client))
</del><ins>+ int clientWidth = getWidth();
+ int clientHeight = getHeight();
+ bool sizeDirty = false;
+ if (!mFixedSize && !IsIconic(getWindowHandle()))
</ins><span class="cx"> {
</span><del>- ASSERT(false);
- return false;
- }
-
- // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
- int clientWidth = client.right - client.left;
- int clientHeight = client.bottom - client.top;
- bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
-
- if (IsIconic(getWindowHandle()))
- {
</del><span class="cx"> // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized
</span><span class="cx"> // because that's not a useful size to render to.
</span><del>- sizeDirty = false;
</del><ins>+ if (!GetClientRect(getWindowHandle(), &client))
+ {
+ ASSERT(false);
+ return false;
+ }
+
+ // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
+ clientWidth = client.right - client.left;
+ clientHeight = client.bottom - client.top;
+ sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool wasDirty = (mSwapIntervalDirty || sizeDirty);
</span><span class="lines">@@ -412,6 +416,11 @@
</span><span class="cx"> return mTexture;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EGLint Surface::isFixedSize() const
+{
+ return mFixedSize;
+}
+
</ins><span class="cx"> EGLenum Surface::getFormat() const
</span><span class="cx"> {
</span><span class="cx"> return mConfig->mRenderTargetFormat;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -34,10 +34,10 @@
</span><span class="cx"> class Surface
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- Surface(Display *display, const egl::Config *config, HWND window, EGLint postSubBufferSupported);
</del><ins>+ Surface(Display *display, const egl::Config *config, HWND window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported);
</ins><span class="cx"> Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
</span><span class="cx">
</span><del>- ~Surface();
</del><ins>+ virtual ~Surface();
</ins><span class="cx">
</span><span class="cx"> bool initialize();
</span><span class="cx"> void release();
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx"> virtual void setBoundTexture(gl::Texture2D *texture);
</span><span class="cx"> virtual gl::Texture2D *getBoundTexture() const;
</span><span class="cx">
</span><ins>+ EGLint isFixedSize() const;
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Surface);
</span><span class="cx">
</span><span class="lines">@@ -99,6 +101,7 @@
</span><span class="cx"> // EGLenum vgColorSpace; // Color space for OpenVG
</span><span class="cx"> EGLint mSwapInterval;
</span><span class="cx"> EGLint mPostSubBufferSupported;
</span><ins>+ EGLint mFixedSize;
</ins><span class="cx">
</span><span class="cx"> bool mSwapIntervalDirty;
</span><span class="cx"> gl::Texture2D *mTexture;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLlibEGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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">@@ -471,6 +471,9 @@
</span><span class="cx"> case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
</span><span class="cx"> *value = eglSurface->isPostSubBufferSupported();
</span><span class="cx"> break;
</span><ins>+ case EGL_FIXED_SIZE_ANGLE:
+ *value = eglSurface->isFixedSize();
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
</span><span class="cx"> }
</span><span class="lines">@@ -779,7 +782,7 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- // Get the requested client version (default is 1) and check it is two.
</del><ins>+ // Get the requested client version (default is 1) and check it is 2 or 3.
</ins><span class="cx"> EGLint client_version = 1;
</span><span class="cx"> bool reset_notification = false;
</span><span class="cx"> bool robust_access = false;
</span><span class="lines">@@ -814,24 +817,32 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (client_version != 2)
</del><ins>+ if (client_version != 2 && client_version != 3)
</ins><span class="cx"> {
</span><span class="cx"> return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Context *sharedContextPtr = (share_context != EGL_NO_CONTEXT ? static_cast<gl::Context*>(share_context) : NULL);
</del><ins>+ egl::Display *display = static_cast<egl::Display*>(dpy);
</ins><span class="cx">
</span><del>- if (sharedContextPtr != NULL && sharedContextPtr->isResetNotificationEnabled() != reset_notification)
</del><ins>+ if (share_context)
</ins><span class="cx"> {
</span><del>- return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
- }
</del><ins>+ gl::Context* sharedGLContext = static_cast<gl::Context*>(share_context);
</ins><span class="cx">
</span><del>- egl::Display *display = static_cast<egl::Display*>(dpy);
</del><ins>+ if (sharedGLContext->isResetNotificationEnabled() != reset_notification)
+ {
+ return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ }
</ins><span class="cx">
</span><del>- // Can not share contexts between displays
- if (sharedContextPtr != NULL && sharedContextPtr->getRenderer() != display->getRenderer())
- {
- return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
</del><ins>+ if (sharedGLContext->getClientVersion() != client_version)
+ {
+ return egl::error(EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
+ }
+
+ // Can not share contexts between displays
+ if (sharedGLContext->getRenderer() != display->getRenderer())
+ {
+ return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!validateConfig(display, config))
</span><span class="lines">@@ -839,12 +850,7 @@
</span><span class="cx"> return EGL_NO_CONTEXT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- EGLContext context = display->createContext(config, static_cast<gl::Context*>(share_context), reset_notification, robust_access);
-
- if (context)
- return egl::success(context);
- else
- return egl::error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
</del><ins>+ return display->createContext(config, client_version, static_cast<gl::Context*>(share_context), reset_notification, robust_access);
</ins><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Buffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</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">@@ -19,15 +19,21 @@
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx">
</span><del>-Buffer::Buffer(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
</del><ins>+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)
</ins><span class="cx"> {
</span><del>- mRenderer = renderer;
- mUsage = GL_DYNAMIC_DRAW;
-
</del><span class="cx"> mBufferStorage = renderer->createBufferStorage();
</span><del>- mStaticVertexBuffer = NULL;
- mStaticIndexBuffer = NULL;
- mUnmodifiedDataUse = 0;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Buffer::~Buffer()
</span><span class="lines">@@ -58,23 +64,51 @@
</span><span class="cx"> {
</span><span class="cx"> mBufferStorage->setData(data, size, offset);
</span><span class="cx"> mIndexRangeCache.invalidateRange(offset, size);
</span><ins>+ invalidateStaticData();
+}
</ins><span class="cx">
</span><del>- if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
- {
- invalidateStaticData();
- }
</del><ins>+void Buffer::copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
+{
+ mBufferStorage->copyData(source->mBufferStorage, size, sourceOffset, destOffset);
+ invalidateStaticData();
+}
</ins><span class="cx">
</span><del>- mUnmodifiedDataUse = 0;
</del><ins>+GLvoid *Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+ ASSERT(!mMapped);
+
+ void *dataPointer = mBufferStorage->map(access);
+
+ mMapped = GL_TRUE;
+ mMapPointer = static_cast<GLvoid*>(static_cast<GLubyte*>(dataPointer) + offset);
+ mMapOffset = static_cast<GLint64>(offset);
+ mMapLength = static_cast<GLint64>(length);
+ mAccessFlags = static_cast<GLint>(access);
+
+ return mMapPointer;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void Buffer::unmap()
+{
+ ASSERT(mMapped);
+
+ mBufferStorage->unmap();
+
+ mMapped = GL_FALSE;
+ mMapPointer = NULL;
+ mMapOffset = 0;
+ mMapLength = 0;
+ mAccessFlags = 0;
+}
+
</ins><span class="cx"> rx::BufferStorage *Buffer::getStorage() const
</span><span class="cx"> {
</span><span class="cx"> return mBufferStorage;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int Buffer::size() const
</del><ins>+GLint64 Buffer::size() const
</ins><span class="cx"> {
</span><del>- return mBufferStorage->getSize();
</del><ins>+ return static_cast<GLint64>(mBufferStorage->getSize());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum Buffer::usage() const
</span><span class="lines">@@ -82,6 +116,37 @@
</span><span class="cx"> return mUsage;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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->markTransformFeedbackUsage();
+ invalidateStaticData();
+}
+
</ins><span class="cx"> rx::StaticVertexBufferInterface *Buffer::getStaticVertexBuffer()
</span><span class="cx"> {
</span><span class="cx"> return mStaticVertexBuffer;
</span><span class="lines">@@ -94,11 +159,14 @@
</span><span class="cx">
</span><span class="cx"> void Buffer::invalidateStaticData()
</span><span class="cx"> {
</span><del>- delete mStaticVertexBuffer;
- mStaticVertexBuffer = NULL;
</del><ins>+ if ((mStaticVertexBuffer && mStaticVertexBuffer->getBufferSize() != 0) || (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0))
+ {
+ delete mStaticVertexBuffer;
+ mStaticVertexBuffer = NULL;
</ins><span class="cx">
</span><del>- delete mStaticIndexBuffer;
- mStaticIndexBuffer = NULL;
</del><ins>+ delete mStaticIndexBuffer;
+ mStaticIndexBuffer = NULL;
+ }
</ins><span class="cx">
</span><span class="cx"> mUnmodifiedDataUse = 0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Bufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h        2014-04-30 22:57:08 UTC (rev 168055)
</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">@@ -35,12 +35,22 @@
</span><span class="cx">
</span><span class="cx"> void bufferData(const void *data, GLsizeiptr size, GLenum usage);
</span><span class="cx"> void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
</span><ins>+ void copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
+ GLvoid *mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
+ void unmap();
</ins><span class="cx">
</span><span class="cx"> GLenum usage() const;
</span><ins>+ GLint accessFlags() const;
+ GLboolean mapped() const;
+ GLvoid *mapPointer() const;
+ GLint64 mapOffset() const;
+ GLint64 mapLength() const;
</ins><span class="cx">
</span><span class="cx"> rx::BufferStorage *getStorage() const;
</span><del>- unsigned int size() const;
</del><ins>+ GLint64 size() const;
</ins><span class="cx">
</span><ins>+ void markTransformFeedbackUsage();
+
</ins><span class="cx"> rx::StaticVertexBufferInterface *getStaticVertexBuffer();
</span><span class="cx"> rx::StaticIndexBufferInterface *getStaticIndexBuffer();
</span><span class="cx"> void invalidateStaticData();
</span><span class="lines">@@ -53,6 +63,11 @@
</span><span class="cx">
</span><span class="cx"> rx::Renderer *mRenderer;
</span><span class="cx"> GLenum mUsage;
</span><ins>+ GLint mAccessFlags;
+ GLboolean mMapped;
+ GLvoid *mMapPointer;
+ GLint64 mMapOffset;
+ GLint64 mMapLength;
</ins><span class="cx">
</span><span class="cx"> rx::BufferStorage *mBufferStorage;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Constantsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Constants.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Constants.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Constants.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,34 +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
-};
-
-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="trunkSourceThirdPartyANGLEsrclibGLESv2Contextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</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">@@ -11,7 +11,8 @@
</span><span class="cx"> #include "libGLESv2/Context.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/main.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
</ins><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx"> #include "libGLESv2/Fence.h"
</span><span class="cx"> #include "libGLESv2/Framebuffer.h"
</span><span class="lines">@@ -24,6 +25,10 @@
</span><span class="cx"> #include "libGLESv2/renderer/IndexDataManager.h"
</span><span class="cx"> #include "libGLESv2/renderer/RenderTarget.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><ins>+#include "libGLESv2/VertexArray.h"
+#include "libGLESv2/Sampler.h"
+#include "libGLESv2/validationES.h"
+#include "libGLESv2/TransformFeedback.h"
</ins><span class="cx">
</span><span class="cx"> #include "libEGL/Surface.h"
</span><span class="cx">
</span><span class="lines">@@ -42,17 +47,20 @@
</span><span class="cx"> return strings.insert(str).first->c_str();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) : mRenderer(renderer)
</del><ins>+Context::Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) : mRenderer(renderer)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(robustAccess == false); // Unimplemented
</span><span class="cx">
</span><del>- mFenceHandleAllocator.setBaseHandle(0);
</del><ins>+ mFenceNVHandleAllocator.setBaseHandle(0);
</ins><span class="cx">
</span><span class="cx"> setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
</span><span class="cx">
</span><ins>+ mClientVersion = clientVersion;
+
</ins><span class="cx"> mState.depthClearValue = 1.0f;
</span><span class="cx"> mState.stencilClearValue = 0;
</span><span class="cx">
</span><ins>+ mState.rasterizer.rasterizerDiscard = false;
</ins><span class="cx"> mState.rasterizer.cullFace = false;
</span><span class="cx"> mState.rasterizer.cullMode = GL_BACK;
</span><span class="cx"> mState.rasterizer.frontFace = GL_CCW;
</span><span class="lines">@@ -122,6 +130,12 @@
</span><span class="cx"> mState.blend.colorMaskBlue = true;
</span><span class="cx"> mState.blend.colorMaskAlpha = true;
</span><span class="cx">
</span><ins>+ const GLfloat defaultFloatValues[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ for (int attribIndex = 0; attribIndex < MAX_VERTEX_ATTRIBS; attribIndex++)
+ {
+ mState.vertexAttribCurrentValues[attribIndex].setFloatValues(defaultFloatValues);
+ }
+
</ins><span class="cx"> if (shareContext != NULL)
</span><span class="cx"> {
</span><span class="cx"> mResourceManager = shareContext->mResourceManager;
</span><span class="lines">@@ -140,8 +154,16 @@
</span><span class="cx">
</span><span class="cx"> mTexture2DZero.set(new Texture2D(mRenderer, 0));
</span><span class="cx"> mTextureCubeMapZero.set(new TextureCubeMap(mRenderer, 0));
</span><ins>+ mTexture3DZero.set(new Texture3D(mRenderer, 0));
+ mTexture2DArrayZero.set(new Texture2DArray(mRenderer, 0));
</ins><span class="cx">
</span><ins>+ for (unsigned int textureUnit = 0; textureUnit < ArraySize(mState.samplers); textureUnit++)
+ {
+ mState.samplers[textureUnit] = 0;
+ }
+
</ins><span class="cx"> mState.activeSampler = 0;
</span><ins>+ bindVertexArray(0);
</ins><span class="cx"> bindArrayBuffer(0);
</span><span class="cx"> bindElementArrayBuffer(0);
</span><span class="cx"> bindTextureCubeMap(0);
</span><span class="lines">@@ -150,14 +172,38 @@
</span><span class="cx"> bindDrawFramebuffer(0);
</span><span class="cx"> bindRenderbuffer(0);
</span><span class="cx">
</span><ins>+ 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 < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; i++)
+ {
+ bindIndexedUniformBuffer(0, i, 0, -1);
+ }
+
+ bindGenericTransformFeedbackBuffer(0);
+ for (int i = 0; i < 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);
+
</ins><span class="cx"> mState.currentProgram = 0;
</span><span class="cx"> mCurrentProgramBinary.set(NULL);
</span><span class="cx">
</span><del>- mState.packAlignment = 4;
- mState.unpackAlignment = 4;
- mState.packReverseRowOrder = false;
-
- mExtensionString = NULL;
</del><ins>+ mCombinedExtensionsString = NULL;
</ins><span class="cx"> mRendererString = NULL;
</span><span class="cx">
</span><span class="cx"> mInvalidEnum = false;
</span><span class="lines">@@ -199,9 +245,9 @@
</span><span class="cx"> deleteFramebuffer(mFramebufferMap.begin()->first);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- while (!mFenceMap.empty())
</del><ins>+ while (!mFenceNVMap.empty())
</ins><span class="cx"> {
</span><del>- deleteFence(mFenceMap.begin()->first);
</del><ins>+ deleteFenceNV(mFenceNVMap.begin()->first);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> while (!mQueryMap.empty())
</span><span class="lines">@@ -209,6 +255,17 @@
</span><span class="cx"> deleteQuery(mQueryMap.begin()->first);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ while (!mVertexArrayMap.empty())
+ {
+ deleteVertexArray(mVertexArrayMap.begin()->first);
+ }
+
+ mTransformFeedbackZero.set(NULL);
+ while (!mTransformFeedbackMap.empty())
+ {
+ deleteTransformFeedback(mTransformFeedbackMap.begin()->first);
+ }
+
</ins><span class="cx"> for (int type = 0; type < TEXTURE_TYPE_COUNT; type++)
</span><span class="cx"> {
</span><span class="cx"> for (int sampler = 0; sampler < IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS; sampler++)
</span><span class="lines">@@ -222,23 +279,45 @@
</span><span class="cx"> mIncompleteTextures[type].set(NULL);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
</del><ins>+ const GLfloat defaultFloatValues[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ for (int attribIndex = 0; attribIndex < MAX_VERTEX_ATTRIBS; attribIndex++)
</ins><span class="cx"> {
</span><del>- mState.vertexAttribute[i].mBoundBuffer.set(NULL);
</del><ins>+ mState.vertexAttribCurrentValues[attribIndex].setFloatValues(defaultFloatValues);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- for (int i = 0; i < QUERY_TYPE_COUNT; i++)
- {
- mState.activeQuery[i].set(NULL);
- }
-
</del><span class="cx"> mState.arrayBuffer.set(NULL);
</span><del>- mState.elementArrayBuffer.set(NULL);
</del><span class="cx"> mState.renderbuffer.set(NULL);
</span><span class="cx">
</span><ins>+ mState.transformFeedback.set(NULL);
+
</ins><span class="cx"> mTexture2DZero.set(NULL);
</span><span class="cx"> mTextureCubeMapZero.set(NULL);
</span><ins>+ mTexture3DZero.set(NULL);
+ mTexture2DArrayZero.set(NULL);
</ins><span class="cx">
</span><ins>+ for (State::ActiveQueryMap::iterator i = mState.activeQueries.begin(); i != mState.activeQueries.end(); i++)
+ {
+ i->second.set(NULL);
+ }
+
+ mState.genericUniformBuffer.set(NULL);
+ for (int i = 0; i < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; i++)
+ {
+ mState.uniformBuffers[i].set(NULL);
+ }
+
+ mState.genericTransformFeedbackBuffer.set(NULL);
+ for (int i = 0; i < 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);
+
</ins><span class="cx"> mResourceManager->release();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -253,14 +332,24 @@
</span><span class="cx"> mSupportsInstancing = mRenderer->getInstancingSupport();
</span><span class="cx">
</span><span class="cx"> mMaxViewportDimension = mRenderer->getMaxViewportDimension();
</span><del>- mMaxTextureDimension = std::min(std::min(mRenderer->getMaxTextureWidth(), mRenderer->getMaxTextureHeight()),
- (int)gl::IMPLEMENTATION_MAX_TEXTURE_SIZE);
- mMaxCubeTextureDimension = std::min(mMaxTextureDimension, (int)gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE);
- mMaxRenderbufferDimension = mMaxTextureDimension;
- mMaxTextureLevel = log2(mMaxTextureDimension) + 1;
</del><ins>+ mMax2DTextureDimension = std::min(std::min(mRenderer->getMaxTextureWidth(), mRenderer->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->getMaxTextureDepth()),
+ (int)gl::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE);
+ mMax2DArrayTextureLayers = mRenderer->getMaxTextureArrayLayers();
+ mMaxRenderbufferDimension = mMax2DTextureDimension;
+ mMax2DTextureLevel = log2(mMax2DTextureDimension) + 1;
+ mMaxCubeTextureLevel = log2(mMaxCubeTextureDimension) + 1;
+ mMax3DTextureLevel = log2(mMax3DTextureDimension) + 1;
+ mMax2DArrayTextureLevel = log2(mMax2DTextureDimension) + 1;
</ins><span class="cx"> mMaxTextureAnisotropy = mRenderer->getTextureMaxAnisotropy();
</span><del>- TRACE("MaxTextureDimension=%d, MaxCubeTextureDimension=%d, MaxRenderbufferDimension=%d, MaxTextureLevel=%d, MaxTextureAnisotropy=%f",
- mMaxTextureDimension, mMaxCubeTextureDimension, mMaxRenderbufferDimension, mMaxTextureLevel, mMaxTextureAnisotropy);
</del><ins>+ TRACE("Max2DTextureDimension=%d, MaxCubeTextureDimension=%d, Max3DTextureDimension=%d, Max2DArrayTextureLayers = %d, "
+ "Max2DTextureLevel=%d, MaxCubeTextureLevel=%d, Max3DTextureLevel=%d, Max2DArrayTextureLevel=%d, "
+ "MaxRenderbufferDimension=%d, MaxTextureAnisotropy=%f",
+ mMax2DTextureDimension, mMaxCubeTextureDimension, mMax3DTextureDimension, mMax2DArrayTextureLayers,
+ mMax2DTextureLevel, mMaxCubeTextureLevel, mMax3DTextureLevel, mMax2DArrayTextureLevel,
+ mMaxRenderbufferDimension, mMaxTextureAnisotropy);
</ins><span class="cx">
</span><span class="cx"> mSupportsEventQueries = mRenderer->getEventQuerySupport();
</span><span class="cx"> mSupportsOcclusionQueries = mRenderer->getOcclusionQuerySupport();
</span><span class="lines">@@ -268,13 +357,19 @@
</span><span class="cx"> mSupportsDXT1Textures = mRenderer->getDXT1TextureSupport();
</span><span class="cx"> mSupportsDXT3Textures = mRenderer->getDXT3TextureSupport();
</span><span class="cx"> mSupportsDXT5Textures = mRenderer->getDXT5TextureSupport();
</span><del>- mSupportsFloat32Textures = mRenderer->getFloat32TextureSupport(&mSupportsFloat32LinearFilter, &mSupportsFloat32RenderableTextures);
- mSupportsFloat16Textures = mRenderer->getFloat16TextureSupport(&mSupportsFloat16LinearFilter, &mSupportsFloat16RenderableTextures);
</del><ins>+ mSupportsFloat32Textures = mRenderer->getFloat32TextureSupport();
+ mSupportsFloat32LinearFilter = mRenderer->getFloat32TextureFilteringSupport();
+ mSupportsFloat32RenderableTextures = mRenderer->getFloat32TextureRenderingSupport();
+ mSupportsFloat16Textures = mRenderer->getFloat16TextureSupport();
+ mSupportsFloat16LinearFilter = mRenderer->getFloat16TextureFilteringSupport();
+ mSupportsFloat16RenderableTextures = mRenderer->getFloat16TextureRenderingSupport();
</ins><span class="cx"> mSupportsLuminanceTextures = mRenderer->getLuminanceTextureSupport();
</span><span class="cx"> mSupportsLuminanceAlphaTextures = mRenderer->getLuminanceAlphaTextureSupport();
</span><ins>+ mSupportsRGTextures = mRenderer->getRGTextureSupport();
</ins><span class="cx"> mSupportsDepthTextures = mRenderer->getDepthTextureSupport();
</span><span class="cx"> mSupportsTextureFilterAnisotropy = mRenderer->getTextureFilterAnisotropySupport();
</span><span class="cx"> mSupports32bitIndices = mRenderer->get32BitIndexSupport();
</span><ins>+ mSupportsPBOs = mRenderer->getPBOSupport();
</ins><span class="cx">
</span><span class="cx"> mNumCompressedTextureFormats = 0;
</span><span class="cx"> if (supportsDXT1Textures())
</span><span class="lines">@@ -314,6 +409,9 @@
</span><span class="cx"> Framebuffer *framebufferZero = new DefaultFramebuffer(mRenderer, colorbufferZero, depthStencilbufferZero);
</span><span class="cx">
</span><span class="cx"> setFramebufferZero(framebufferZero);
</span><ins>+
+ // Store the current client version in the renderer
+ mRenderer->setCurrentClientVersion(mClientVersion);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // NOTE: this function should not assume that this context is current!
</span><span class="lines">@@ -329,6 +427,44 @@
</span><span class="cx"> return mContextLost;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+ }
+}
+
</ins><span class="cx"> void Context::setClearColor(float red, float green, float blue, float alpha)
</span><span class="cx"> {
</span><span class="cx"> mState.colorClearValue.red = red;
</span><span class="lines">@@ -347,6 +483,16 @@
</span><span class="cx"> mState.stencilClearValue = stencil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Context::setRasterizerDiscard(bool enabled)
+{
+ mState.rasterizer.rasterizerDiscard = enabled;
+}
+
+bool Context::isRasterizerDiscardEnabled() const
+{
+ return mState.rasterizer.rasterizerDiscard;
+}
+
</ins><span class="cx"> void Context::setCullFace(bool enabled)
</span><span class="cx"> {
</span><span class="cx"> mState.rasterizer.cullFace = enabled;
</span><span class="lines">@@ -565,6 +711,14 @@
</span><span class="cx"> mState.scissor.height = height;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> void Context::setColorMask(bool red, bool green, bool blue, bool alpha)
</span><span class="cx"> {
</span><span class="cx"> mState.blend.colorMaskRed = red;
</span><span class="lines">@@ -598,6 +752,17 @@
</span><span class="cx"> return mState.renderbuffer.id();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLuint Context::getVertexArrayHandle() const
+{
+ return mState.vertexArray;
+}
+
+GLuint Context::getSamplerHandle(GLuint textureUnit) const
+{
+ ASSERT(textureUnit < ArraySize(mState.samplers));
+ return mState.samplers[textureUnit];
+}
+
</ins><span class="cx"> GLuint Context::getArrayBufferHandle() const
</span><span class="cx"> {
</span><span class="cx"> return mState.arrayBuffer.id();
</span><span class="lines">@@ -605,86 +770,80 @@
</span><span class="cx">
</span><span class="cx"> GLuint Context::getActiveQuery(GLenum target) const
</span><span class="cx"> {
</span><del>- Query *queryObject = NULL;
-
- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED].get();
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE].get();
- break;
- default:
- ASSERT(false);
- }
</del><ins>+ // All query types should already exist in the activeQueries map
+ ASSERT(mState.activeQueries.find(target) != mState.activeQueries.end());
</ins><span class="cx">
</span><del>- if (queryObject)
- {
- return queryObject->id();
- }
- else
- {
- return 0;
- }
</del><ins>+ const Query *queryObject = mState.activeQueries.at(target).get();
+ return queryObject ? queryObject->id() : 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
</span><span class="cx"> {
</span><del>- mState.vertexAttribute[attribNum].mArrayEnabled = enabled;
</del><ins>+ getCurrentVertexArray()->enableAttribute(attribNum, enabled);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-const VertexAttribute &Context::getVertexAttribState(unsigned int attribNum)
</del><ins>+const VertexAttribute &Context::getVertexAttribState(unsigned int attribNum) const
</ins><span class="cx"> {
</span><del>- return mState.vertexAttribute[attribNum];
</del><ins>+ return getCurrentVertexArray()->getVertexAttribute(attribNum);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+const VertexAttribCurrentValueData &Context::getVertexAttribCurrentValue(unsigned int attribNum) const
+{
+ ASSERT(attribNum < MAX_VERTEX_ATTRIBS);
+ return mState.vertexAttribCurrentValues[attribNum];
+}
+
</ins><span class="cx"> void Context::setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
</span><del>- GLsizei stride, const void *pointer)
</del><ins>+ bool pureInteger, GLsizei stride, const void *pointer)
</ins><span class="cx"> {
</span><del>- mState.vertexAttribute[attribNum].mBoundBuffer.set(boundBuffer);
- mState.vertexAttribute[attribNum].mSize = size;
- mState.vertexAttribute[attribNum].mType = type;
- mState.vertexAttribute[attribNum].mNormalized = normalized;
- mState.vertexAttribute[attribNum].mStride = stride;
- mState.vertexAttribute[attribNum].mPointer = pointer;
</del><ins>+ getCurrentVertexArray()->setAttributeState(attribNum, boundBuffer, size, type, normalized, pureInteger, stride, pointer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const void *Context::getVertexAttribPointer(unsigned int attribNum) const
</span><span class="cx"> {
</span><del>- return mState.vertexAttribute[attribNum].mPointer;
</del><ins>+ return getCurrentVertexArray()->getVertexAttribute(attribNum).mPointer;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::setPackAlignment(GLint alignment)
</span><span class="cx"> {
</span><del>- mState.packAlignment = alignment;
</del><ins>+ mState.pack.alignment = alignment;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLint Context::getPackAlignment() const
</span><span class="cx"> {
</span><del>- return mState.packAlignment;
</del><ins>+ return mState.pack.alignment;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::setUnpackAlignment(GLint alignment)
</span><span class="cx"> {
</span><del>- mState.unpackAlignment = alignment;
</del><ins>+ mState.unpack.alignment = alignment;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLint Context::getUnpackAlignment() const
</span><span class="cx"> {
</span><del>- return mState.unpackAlignment;
</del><ins>+ return mState.unpack.alignment;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::setPackReverseRowOrder(bool reverseRowOrder)
</span><span class="cx"> {
</span><del>- mState.packReverseRowOrder = reverseRowOrder;
</del><ins>+ mState.pack.reverseRowOrder = reverseRowOrder;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Context::getPackReverseRowOrder() const
</span><span class="cx"> {
</span><del>- return mState.packReverseRowOrder;
</del><ins>+ return mState.pack.reverseRowOrder;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+const PixelUnpackState &Context::getUnpackState() const
+{
+ return mState.unpack;
+}
+
+const PixelPackState &Context::getPackState() const
+{
+ return mState.pack;
+}
+
</ins><span class="cx"> GLuint Context::createBuffer()
</span><span class="cx"> {
</span><span class="cx"> return mResourceManager->createBuffer();
</span><span class="lines">@@ -710,6 +869,44 @@
</span><span class="cx"> return mResourceManager->createRenderbuffer();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLsync Context::createFenceSync(GLenum condition)
+{
+ GLuint handle = mResourceManager->createFenceSync();
+
+ gl::FenceSync *fenceSync = mResourceManager->getFenceSync(handle);
+ ASSERT(fenceSync);
+
+ fenceSync->set(condition);
+
+ return reinterpret_cast<GLsync>(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->createSampler();
+}
+
+GLuint Context::createTransformFeedback()
+{
+ GLuint handle = mTransformFeedbackAllocator.allocate();
+ TransformFeedback *transformFeedback = new TransformFeedback(handle);
+ transformFeedback->addRef();
+ mTransformFeedbackMap[handle] = transformFeedback;
+ return handle;
+}
+
</ins><span class="cx"> // Returns an unused framebuffer name
</span><span class="cx"> GLuint Context::createFramebuffer()
</span><span class="cx"> {
</span><span class="lines">@@ -720,11 +917,11 @@
</span><span class="cx"> return handle;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GLuint Context::createFence()
</del><ins>+GLuint Context::createFenceNV()
</ins><span class="cx"> {
</span><del>- GLuint handle = mFenceHandleAllocator.allocate();
</del><ins>+ GLuint handle = mFenceNVHandleAllocator.allocate();
</ins><span class="cx">
</span><del>- mFenceMap[handle] = new Fence(mRenderer);
</del><ins>+ mFenceNVMap[handle] = new FenceNV(mRenderer);
</ins><span class="cx">
</span><span class="cx"> return handle;
</span><span class="cx"> }
</span><span class="lines">@@ -779,6 +976,51 @@
</span><span class="cx"> mResourceManager->deleteRenderbuffer(renderbuffer);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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->deleteFenceSync(reinterpret_cast<GLuint>(fenceSync));
+}
+
+void Context::deleteVertexArray(GLuint vertexArray)
+{
+ auto vertexArrayObject = mVertexArrayMap.find(vertexArray);
+
+ if (vertexArrayObject != mVertexArrayMap.end())
+ {
+ detachVertexArray(vertexArray);
+
+ mVertexArrayHandleAllocator.release(vertexArrayObject->first);
+ delete vertexArrayObject->second;
+ mVertexArrayMap.erase(vertexArrayObject);
+ }
+}
+
+void Context::deleteSampler(GLuint sampler)
+{
+ if (mResourceManager->getSampler(sampler))
+ {
+ detachSampler(sampler);
+ }
+
+ mResourceManager->deleteSampler(sampler);
+}
+
+void Context::deleteTransformFeedback(GLuint transformFeedback)
+{
+ TransformFeedbackMap::const_iterator iter = mTransformFeedbackMap.find(transformFeedback);
+ if (iter != mTransformFeedbackMap.end())
+ {
+ detachTransformFeedback(transformFeedback);
+ mTransformFeedbackAllocator.release(transformFeedback);
+ iter->second->release();
+ mTransformFeedbackMap.erase(iter);
+ }
+}
+
</ins><span class="cx"> void Context::deleteFramebuffer(GLuint framebuffer)
</span><span class="cx"> {
</span><span class="cx"> FramebufferMap::iterator framebufferObject = mFramebufferMap.find(framebuffer);
</span><span class="lines">@@ -793,15 +1035,15 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Context::deleteFence(GLuint fence)
</del><ins>+void Context::deleteFenceNV(GLuint fence)
</ins><span class="cx"> {
</span><del>- FenceMap::iterator fenceObject = mFenceMap.find(fence);
</del><ins>+ FenceNVMap::iterator fenceObject = mFenceNVMap.find(fence);
</ins><span class="cx">
</span><del>- if (fenceObject != mFenceMap.end())
</del><ins>+ if (fenceObject != mFenceNVMap.end())
</ins><span class="cx"> {
</span><del>- mFenceHandleAllocator.release(fenceObject->first);
</del><ins>+ mFenceNVHandleAllocator.release(fenceObject->first);
</ins><span class="cx"> delete fenceObject->second;
</span><del>- mFenceMap.erase(fenceObject);
</del><ins>+ mFenceNVMap.erase(fenceObject);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -824,12 +1066,12 @@
</span><span class="cx"> return mResourceManager->getBuffer(handle);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Shader *Context::getShader(GLuint handle)
</del><ins>+Shader *Context::getShader(GLuint handle) const
</ins><span class="cx"> {
</span><span class="cx"> return mResourceManager->getShader(handle);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Program *Context::getProgram(GLuint handle)
</del><ins>+Program *Context::getProgram(GLuint handle) const
</ins><span class="cx"> {
</span><span class="cx"> return mResourceManager->getProgram(handle);
</span><span class="cx"> }
</span><span class="lines">@@ -844,6 +1086,43 @@
</span><span class="cx"> return mResourceManager->getRenderbuffer(handle);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+FenceSync *Context::getFenceSync(GLsync handle) const
+{
+ return mResourceManager->getFenceSync(reinterpret_cast<GLuint>(handle));
+}
+
+VertexArray *Context::getVertexArray(GLuint handle) const
+{
+ auto vertexArray = mVertexArrayMap.find(handle);
+
+ if (vertexArray == mVertexArrayMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return vertexArray->second;
+ }
+}
+
+Sampler *Context::getSampler(GLuint handle) const
+{
+ return mResourceManager->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->second : NULL;
+ }
+}
+
</ins><span class="cx"> Framebuffer *Context::getReadFramebuffer()
</span><span class="cx"> {
</span><span class="cx"> return getFramebuffer(mState.readFramebuffer);
</span><span class="lines">@@ -854,6 +1133,23 @@
</span><span class="cx"> return mBoundDrawFramebuffer;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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->isSampler(samplerName);
+}
+
</ins><span class="cx"> void Context::bindArrayBuffer(unsigned int buffer)
</span><span class="cx"> {
</span><span class="cx"> mResourceManager->checkBufferAllocation(buffer);
</span><span class="lines">@@ -865,7 +1161,7 @@
</span><span class="cx"> {
</span><span class="cx"> mResourceManager->checkBufferAllocation(buffer);
</span><span class="cx">
</span><del>- mState.elementArrayBuffer.set(getBuffer(buffer));
</del><ins>+ getCurrentVertexArray()->setElementArrayBuffer(getBuffer(buffer));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::bindTexture2D(GLuint texture)
</span><span class="lines">@@ -882,6 +1178,20 @@
</span><span class="cx"> mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].set(getTexture(texture));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Context::bindTexture3D(GLuint texture)
+{
+ mResourceManager->checkTextureAllocation(texture, TEXTURE_3D);
+
+ mState.samplerTexture[TEXTURE_3D][mState.activeSampler].set(getTexture(texture));
+}
+
+void Context::bindTexture2DArray(GLuint texture)
+{
+ mResourceManager->checkTextureAllocation(texture, TEXTURE_2D_ARRAY);
+
+ mState.samplerTexture[TEXTURE_2D_ARRAY][mState.activeSampler].set(getTexture(texture));
+}
+
</ins><span class="cx"> void Context::bindReadFramebuffer(GLuint framebuffer)
</span><span class="cx"> {
</span><span class="cx"> if (!getFramebuffer(framebuffer))
</span><span class="lines">@@ -911,6 +1221,80 @@
</span><span class="cx"> mState.renderbuffer.set(getRenderbuffer(renderbuffer));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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 < ArraySize(mState.samplers));
+ mResourceManager->checkSamplerAllocation(sampler);
+
+ mState.samplers[textureUnit] = sampler;
+}
+
+void Context::bindGenericUniformBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.genericUniformBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.uniformBuffers[index].set(getBuffer(buffer), offset, size);
+}
+
+void Context::bindGenericTransformFeedbackBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.genericTransformFeedbackBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.transformFeedbackBuffers[index].set(getBuffer(buffer), offset, size);
+}
+
+void Context::bindCopyReadBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.copyReadBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindCopyWriteBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.copyWriteBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindPixelPackBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.pack.pixelBuffer.set(getBuffer(buffer));
+}
+
+void Context::bindPixelUnpackBuffer(GLuint buffer)
+{
+ mResourceManager->checkBufferAllocation(buffer);
+
+ mState.unpack.pixelBuffer.set(getBuffer(buffer));
+}
+
</ins><span class="cx"> void Context::useProgram(GLuint program)
</span><span class="cx"> {
</span><span class="cx"> GLuint priorProgram = mState.currentProgram;
</span><span class="lines">@@ -964,6 +1348,12 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Context::bindTransformFeedback(GLuint transformFeedback)
+{
+ TransformFeedback *transformFeedbackObject = getTransformFeedback(transformFeedback);
+ mState.transformFeedback.set(transformFeedbackObject);
+}
+
</ins><span class="cx"> void Context::beginQuery(GLenum target, GLuint query)
</span><span class="cx"> {
</span><span class="cx"> // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an <id>
</span><span class="lines">@@ -981,28 +1371,14 @@
</span><span class="cx"> // b) There are no active queries for the requested target (and in the case
</span><span class="cx"> // of GL_ANY_SAMPLES_PASSED_EXT and GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
</span><span class="cx"> // no query may be active for either if glBeginQuery targets either.
</span><del>- for (int i = 0; i < QUERY_TYPE_COUNT; i++)
</del><ins>+ for (State::ActiveQueryMap::iterator i = mState.activeQueries.begin(); i != mState.activeQueries.end(); i++)
</ins><span class="cx"> {
</span><del>- if (mState.activeQuery[i].get() != NULL)
</del><ins>+ if (i->second.get() != NULL)
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- QueryType qType;
- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED;
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE;
- break;
- default:
- ASSERT(false);
- return;
- }
-
</del><span class="cx"> Query *queryObject = getQuery(query, true, target);
</span><span class="cx">
</span><span class="cx"> // check that name was obtained with glGenQueries
</span><span class="lines">@@ -1018,7 +1394,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // set query as active for specified target
</span><del>- mState.activeQuery[qType].set(queryObject);
</del><ins>+ mState.activeQueries[target].set(queryObject);
</ins><span class="cx">
</span><span class="cx"> // begin query
</span><span class="cx"> queryObject->begin();
</span><span class="lines">@@ -1026,23 +1402,8 @@
</span><span class="cx">
</span><span class="cx"> void Context::endQuery(GLenum target)
</span><span class="cx"> {
</span><del>- QueryType qType;
</del><ins>+ Query *queryObject = mState.activeQueries[target].get();
</ins><span class="cx">
</span><del>- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED;
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE;
- break;
- default:
- ASSERT(false);
- return;
- }
-
- Query *queryObject = mState.activeQuery[qType].get();
-
</del><span class="cx"> if (queryObject == NULL)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="lines">@@ -1050,7 +1411,7 @@
</span><span class="cx">
</span><span class="cx"> queryObject->end();
</span><span class="cx">
</span><del>- mState.activeQuery[qType].set(NULL);
</del><ins>+ mState.activeQueries[target].set(NULL);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::setFramebufferZero(Framebuffer *buffer)
</span><span class="lines">@@ -1065,36 +1426,41 @@
</span><span class="cx">
</span><span class="cx"> void Context::setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples)
</span><span class="cx"> {
</span><ins>+ const bool color = gl::IsColorRenderingSupported(internalformat, this);
+ const bool depth = gl::IsDepthRenderingSupported(internalformat, this);
+ const bool stencil = gl::IsStencilRenderingSupported(internalformat, this);
+
</ins><span class="cx"> RenderbufferStorage *renderbuffer = NULL;
</span><del>- switch (internalformat)
</del><ins>+
+ if (color)
</ins><span class="cx"> {
</span><del>- case GL_DEPTH_COMPONENT16:
- renderbuffer = new gl::Depthbuffer(mRenderer, width, height, samples);
- break;
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
</del><span class="cx"> renderbuffer = new gl::Colorbuffer(mRenderer,width, height, internalformat, samples);
</span><del>- break;
- case GL_STENCIL_INDEX8:
- renderbuffer = new gl::Stencilbuffer(mRenderer, width, height, samples);
- break;
- case GL_DEPTH24_STENCIL8_OES:
</del><ins>+ }
+ else if (depth && stencil)
+ {
</ins><span class="cx"> renderbuffer = new gl::DepthStencilbuffer(mRenderer, width, height, samples);
</span><del>- break;
- default:
- UNREACHABLE(); return;
</del><span class="cx"> }
</span><ins>+ 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;
+ }
</ins><span class="cx">
</span><span class="cx"> Renderbuffer *renderbufferObject = mState.renderbuffer.get();
</span><span class="cx"> renderbufferObject->setStorage(renderbuffer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Framebuffer *Context::getFramebuffer(unsigned int handle)
</del><ins>+Framebuffer *Context::getFramebuffer(unsigned int handle) const
</ins><span class="cx"> {
</span><del>- FramebufferMap::iterator framebuffer = mFramebufferMap.find(handle);
</del><ins>+ FramebufferMap::const_iterator framebuffer = mFramebufferMap.find(handle);
</ins><span class="cx">
</span><span class="cx"> if (framebuffer == mFramebufferMap.end())
</span><span class="cx"> {
</span><span class="lines">@@ -1106,11 +1472,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Fence *Context::getFence(unsigned int handle)
</del><ins>+FenceNV *Context::getFenceNV(unsigned int handle)
</ins><span class="cx"> {
</span><del>- FenceMap::iterator fence = mFenceMap.find(handle);
</del><ins>+ FenceNVMap::iterator fence = mFenceNVMap.find(handle);
</ins><span class="cx">
</span><del>- if (fence == mFenceMap.end())
</del><ins>+ if (fence == mFenceNVMap.end())
</ins><span class="cx"> {
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="lines">@@ -1139,14 +1505,30 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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()->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;
+ }
+}
+
</ins><span class="cx"> Buffer *Context::getArrayBuffer()
</span><span class="cx"> {
</span><span class="cx"> return mState.arrayBuffer.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Buffer *Context::getElementArrayBuffer()
</del><ins>+Buffer *Context::getElementArrayBuffer() const
</ins><span class="cx"> {
</span><del>- return mState.elementArrayBuffer.get();
</del><ins>+ return getCurrentVertexArray()->getElementArrayBuffer();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ProgramBinary *Context::getCurrentProgramBinary()
</span><span class="lines">@@ -1154,18 +1536,98 @@
</span><span class="cx"> return mCurrentProgramBinary.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Texture2D *Context::getTexture2D()
</del><ins>+Texture *Context::getTargetTexture(GLenum target) const
</ins><span class="cx"> {
</span><ins>+ 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
+{
</ins><span class="cx"> return static_cast<Texture2D*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureCubeMap *Context::getTextureCubeMap()
</del><ins>+TextureCubeMap *Context::getTextureCubeMap() const
</ins><span class="cx"> {
</span><span class="cx"> return static_cast<TextureCubeMap*>(getSamplerTexture(mState.activeSampler, TEXTURE_CUBE));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type)
</del><ins>+Texture3D *Context::getTexture3D() const
</ins><span class="cx"> {
</span><ins>+ return static_cast<Texture3D*>(getSamplerTexture(mState.activeSampler, TEXTURE_3D));
+}
+
+Texture2DArray *Context::getTexture2DArray() const
+{
+ return static_cast<Texture2DArray*>(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
+{
</ins><span class="cx"> GLuint texid = mState.samplerTexture[type][sampler].id();
</span><span class="cx">
</span><span class="cx"> if (texid == 0) // Special case: 0 refers to different initial textures based on the target
</span><span class="lines">@@ -1173,8 +1635,10 @@
</span><span class="cx"> switch (type)
</span><span class="cx"> {
</span><span class="cx"> default: UNREACHABLE();
</span><del>- case TEXTURE_2D: return mTexture2DZero.get();
- case TEXTURE_CUBE: return mTextureCubeMapZero.get();
</del><ins>+ 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();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1204,6 +1668,8 @@
</span><span class="cx"> case GL_BLEND: *params = mState.blend.blend; break;
</span><span class="cx"> case GL_DITHER: *params = mState.blend.dither; break;
</span><span class="cx"> case GL_CONTEXT_ROBUST_ACCESS_EXT: *params = mRobustAccess ? GL_TRUE : GL_FALSE; break;
</span><ins>+ case GL_TRANSFORM_FEEDBACK_ACTIVE: *params = getCurrentTransformFeedback()->isStarted(); break;
+ case GL_TRANSFORM_FEEDBACK_PAUSED: *params = getCurrentTransformFeedback()->isPaused(); break;
</ins><span class="cx"> default:
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1287,56 +1753,73 @@
</span><span class="cx"> // Context::getFloatv.
</span><span class="cx"> switch (pname)
</span><span class="cx"> {
</span><del>- case GL_MAX_VERTEX_ATTRIBS: *params = gl::MAX_VERTEX_ATTRIBS; break;
- case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = mRenderer->getMaxVertexUniformVectors(); break;
- case GL_MAX_VARYING_VECTORS: *params = mRenderer->getMaxVaryingVectors(); break;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxCombinedTextureImageUnits(); break;
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxVertexTextureImageUnits(); break;
- case GL_MAX_TEXTURE_IMAGE_UNITS: *params = gl::MAX_TEXTURE_IMAGE_UNITS; break;
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = mRenderer->getMaxFragmentUniformVectors(); break;
- case GL_MAX_RENDERBUFFER_SIZE: *params = getMaximumRenderbufferDimension(); break;
- case GL_MAX_COLOR_ATTACHMENTS_EXT: *params = mRenderer->getMaxRenderTargets(); break;
- case GL_MAX_DRAW_BUFFERS_EXT: *params = mRenderer->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 = mState.elementArrayBuffer.id(); break;
- //case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
- case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: *params = mState.drawFramebuffer; break;
- case GL_READ_FRAMEBUFFER_BINDING_ANGLE: *params = mState.readFramebuffer; break;
- case GL_RENDERBUFFER_BINDING: *params = mState.renderbuffer.id(); break;
- case GL_CURRENT_PROGRAM: *params = mState.currentProgram; break;
- case GL_PACK_ALIGNMENT: *params = mState.packAlignment; break;
- case GL_PACK_REVERSE_ROW_ORDER_ANGLE: *params = mState.packReverseRowOrder; break;
- case GL_UNPACK_ALIGNMENT: *params = mState.unpackAlignment; break;
- case GL_GENERATE_MIPMAP_HINT: *params = mState.generateMipmapHint; break;
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mState.fragmentShaderDerivativeHint; break;
- case GL_ACTIVE_TEXTURE: *params = (mState.activeSampler + GL_TEXTURE0); break;
- case GL_STENCIL_FUNC: *params = mState.depthStencil.stencilFunc; break;
- case GL_STENCIL_REF: *params = mState.stencilRef; break;
- case GL_STENCIL_VALUE_MASK: *params = 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 = 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 = mState.depthStencil.stencilWritemask; break;
- case GL_STENCIL_BACK_WRITEMASK: *params = 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 = getMaximumTextureDimension(); break;
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *params = getMaximumCubeTextureDimension(); break;
</del><ins>+ case GL_MAX_VERTEX_ATTRIBS: *params = gl::MAX_VERTEX_ATTRIBS; break;
+ case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = mRenderer->getMaxVertexUniformVectors(); break;
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS: *params = mRenderer->getMaxVertexUniformVectors() * 4; break;
+ case GL_MAX_VARYING_VECTORS: *params = mRenderer->getMaxVaryingVectors(); break;
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxCombinedTextureImageUnits(); break;
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = mRenderer->getMaxVertexTextureImageUnits(); break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS: *params = gl::MAX_TEXTURE_IMAGE_UNITS; break;
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = mRenderer->getMaxFragmentUniformVectors(); break;
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: *params = mRenderer->getMaxFragmentUniformVectors() * 4; break;
+ case GL_MAX_RENDERBUFFER_SIZE: *params = getMaximumRenderbufferDimension(); break;
+ case GL_MAX_COLOR_ATTACHMENTS_EXT: *params = mRenderer->getMaxRenderTargets(); break;
+ case GL_MAX_DRAW_BUFFERS_EXT: *params = mRenderer->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()->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->getMaxVertexShaderUniformBuffers(); break;
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: *params = mRenderer->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->getMaxRecommendedElementsIndices(); break;
+ case GL_MAX_ELEMENTS_VERTICES: *params = mRenderer->getMaxRecommendedElementsVertices(); break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackInterleavedComponents(); break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = mRenderer->getMaxTransformFeedbackBuffers(); break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackSeparateComponents(); break;
</ins><span class="cx"> case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
</span><span class="cx"> params[0] = mNumCompressedTextureFormats;
</span><span class="cx"> break;
</span><span class="lines">@@ -1386,8 +1869,8 @@
</span><span class="cx"> case GL_IMPLEMENTATION_COLOR_READ_TYPE:
</span><span class="cx"> case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
</span><span class="cx"> {
</span><del>- GLenum format, type;
- if (getCurrentReadFormatType(&format, &type))
</del><ins>+ GLenum internalFormat, format, type;
+ if (getCurrentReadFormatType(&internalFormat, &format, &type))
</ins><span class="cx"> {
</span><span class="cx"> if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT)
</span><span class="cx"> *params = format;
</span><span class="lines">@@ -1509,6 +1992,28 @@
</span><span class="cx"> *params = mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].id();
</span><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+ case GL_TEXTURE_BINDING_3D:
+ {
+ if (mState.activeSampler > mRenderer->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 > mRenderer->getMaxCombinedTextureImageUnits() - 1)
+ {
+ gl::error(GL_INVALID_OPERATION);
+ return false;
+ }
+
+ *params = mState.samplerTexture[TEXTURE_2D_ARRAY][mState.activeSampler].id();
+ }
+ break;
</ins><span class="cx"> case GL_RESET_NOTIFICATION_STRATEGY_EXT:
</span><span class="cx"> *params = mResetStrategy;
</span><span class="cx"> break;
</span><span class="lines">@@ -1518,6 +2023,27 @@
</span><span class="cx"> case GL_PROGRAM_BINARY_FORMATS_OES:
</span><span class="cx"> *params = GL_PROGRAM_BINARY_ANGLE;
</span><span class="cx"> break;
</span><ins>+ 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<GLint>(getNumExtensions());
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1525,6 +2051,99 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Context::getInteger64v(GLenum pname, GLint64 *params)
+{
+ switch (pname)
+ {
+ case GL_MAX_ELEMENT_INDEX:
+ *params = static_cast<GLint64>(std::numeric_limits<unsigned int>::max());
+ break;
+ case GL_MAX_UNIFORM_BLOCK_SIZE:
+ *params = static_cast<GLint64>(mRenderer->getMaxUniformBufferSize());
+ break;
+ case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+ {
+ GLint64 uniformBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexShaderUniformBuffers()) * static_cast<GLint64>(mRenderer->getMaxUniformBufferSize() / 4);
+ GLint64 defaultBufferComponents = static_cast<GLint64>(mRenderer->getMaxVertexUniformVectors() * 4);
+ *params = uniformBufferComponents + defaultBufferComponents;
+ }
+ break;
+ case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+ {
+ GLint64 uniformBufferComponents = static_cast<GLint64>(mRenderer->getMaxFragmentShaderUniformBuffers()) * static_cast<GLint64>(mRenderer->getMaxUniformBufferSize() / 4);
+ GLint64 defaultBufferComponents = static_cast<GLint64>(mRenderer->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 < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
+ {
+ *data = mState.transformFeedbackBuffers[index].id();
+ }
+ break;
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index < 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 < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
+ {
+ *data = mState.transformFeedbackBuffers[index].getOffset();
+ }
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ if (index < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
+ {
+ *data = mState.transformFeedbackBuffers[index].getSize();
+ }
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ if (index < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
+ {
+ *data = mState.uniformBuffers[index].getOffset();
+ }
+ break;
+ case GL_UNIFORM_BUFFER_SIZE:
+ if (index < IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
+ {
+ *data = mState.uniformBuffers[index].getSize();
+ }
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
</ins><span class="cx"> bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
</span><span class="cx"> {
</span><span class="cx"> if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
</span><span class="lines">@@ -1548,13 +2167,13 @@
</span><span class="cx"> *type = GL_INT;
</span><span class="cx"> *numParams = mNumCompressedTextureFormats;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_SHADER_BINARY_FORMATS:
</span><span class="cx"> {
</span><span class="cx"> *type = GL_INT;
</span><span class="cx"> *numParams = 0;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_MAX_VERTEX_ATTRIBS:
</span><span class="cx"> case GL_MAX_VERTEX_UNIFORM_VECTORS:
</span><span class="cx"> case GL_MAX_VARYING_VECTORS:
</span><span class="lines">@@ -1624,7 +2243,7 @@
</span><span class="cx"> *type = GL_INT;
</span><span class="cx"> *numParams = 1;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_MAX_SAMPLES_ANGLE:
</span><span class="cx"> {
</span><span class="cx"> if (getMaxSupportedSamples() != 0)
</span><span class="lines">@@ -1637,20 +2256,20 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_MAX_VIEWPORT_DIMS:
</span><span class="cx"> {
</span><span class="cx"> *type = GL_INT;
</span><span class="cx"> *numParams = 2;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_VIEWPORT:
</span><span class="cx"> case GL_SCISSOR_BOX:
</span><span class="cx"> {
</span><span class="cx"> *type = GL_INT;
</span><span class="cx"> *numParams = 4;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_SHADER_COMPILER:
</span><span class="cx"> case GL_SAMPLE_COVERAGE_INVERT:
</span><span class="cx"> case GL_DEPTH_WRITEMASK:
</span><span class="lines">@@ -1668,13 +2287,13 @@
</span><span class="cx"> *type = GL_BOOL;
</span><span class="cx"> *numParams = 1;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_COLOR_WRITEMASK:
</span><span class="cx"> {
</span><span class="cx"> *type = GL_BOOL;
</span><span class="cx"> *numParams = 4;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_POLYGON_OFFSET_FACTOR:
</span><span class="cx"> case GL_POLYGON_OFFSET_UNITS:
</span><span class="cx"> case GL_SAMPLE_COVERAGE_VALUE:
</span><span class="lines">@@ -1684,7 +2303,7 @@
</span><span class="cx"> *type = GL_FLOAT;
</span><span class="cx"> *numParams = 1;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_ALIASED_LINE_WIDTH_RANGE:
</span><span class="cx"> case GL_ALIASED_POINT_SIZE_RANGE:
</span><span class="cx"> case GL_DEPTH_RANGE:
</span><span class="lines">@@ -1692,14 +2311,14 @@
</span><span class="cx"> *type = GL_FLOAT;
</span><span class="cx"> *numParams = 2;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_COLOR_CLEAR_VALUE:
</span><span class="cx"> case GL_BLEND_COLOR:
</span><span class="cx"> {
</span><span class="cx"> *type = GL_FLOAT;
</span><span class="cx"> *numParams = 4;
</span><span class="cx"> }
</span><del>- break;
</del><ins>+ return true;
</ins><span class="cx"> case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
</span><span class="cx"> if (!supportsTextureFilterAnisotropy())
</span><span class="cx"> {
</span><span class="lines">@@ -1707,14 +2326,101 @@
</span><span class="cx"> }
</span><span class="cx"> *type = GL_FLOAT;
</span><span class="cx"> *numParams = 1;
</span><del>- break;
- default:
</del><ins>+ return true;
+ }
+
+ if (mClientVersion < 3)
+ {
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return true;
</del><ins>+ // 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;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Context::getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams)
+{
+ if (mClientVersion < 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;
+}
+
</ins><span class="cx"> // Applies the render target surface, depth stencil surface, viewport rectangle and
</span><span class="cx"> // scissor rectangle to the renderer
</span><span class="cx"> bool Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport)
</span><span class="lines">@@ -1785,33 +2491,91 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Applies the shaders and shader constants to the Direct3D 9 device
</span><del>-void Context::applyShaders()
</del><ins>+void Context::applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive)
</ins><span class="cx"> {
</span><del>- ProgramBinary *programBinary = getCurrentProgramBinary();
</del><ins>+ const VertexAttribute *vertexAttributes = getCurrentVertexArray()->getVertexAttributes();
</ins><span class="cx">
</span><del>- mRenderer->applyShaders(programBinary);
-
</del><ins>+ VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS];
+ VertexFormat::GetInputLayout(inputLayout, programBinary, vertexAttributes, mState.vertexAttribCurrentValues);
+
+ mRenderer->applyShaders(programBinary, mState.rasterizer.rasterizerDiscard, transformFeedbackActive, inputLayout);
+
</ins><span class="cx"> programBinary->applyUniforms();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Context::getCurrentTextureAndSamplerState(ProgramBinary *programBinary, SamplerType type, int index, Texture **outTexture,
+ TextureType *outTextureType, SamplerState *outSampler)
+{
+ int textureUnit = programBinary->getSamplerMapping(type, index); // OpenGL texture image unit index
+
+ if (textureUnit != -1)
+ {
+ TextureType textureType = programBinary->getSamplerTextureType(type, index);
+ Texture *texture = getSamplerTexture(textureUnit, textureType);
+
+ SamplerState samplerState;
+ texture->getSamplerState(&samplerState);
+
+ if (mState.samplers[textureUnit] != 0)
+ {
+ Sampler *samplerObject = getSampler(mState.samplers[textureUnit]);
+ samplerObject->getState(&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->getUsedSamplerRange(type);
+ for (int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
+ {
+ Texture *texture = NULL;
+ TextureType textureType;
+ SamplerState samplerState;
+ if (getCurrentTextureAndSamplerState(programBinary, type, samplerIndex, &texture, &textureType, &samplerState) && texture->isSwizzled())
+ {
+ mRenderer->generateSwizzle(texture);
+ }
+ }
+}
+
</ins><span class="cx"> // Applies the textures and sampler states to the Direct3D 9 device
</span><del>-void Context::applyTextures()
</del><ins>+void Context::applyTextures(ProgramBinary *programBinary)
</ins><span class="cx"> {
</span><del>- applyTextures(SAMPLER_PIXEL);
</del><ins>+ applyTextures(programBinary, SAMPLER_PIXEL);
</ins><span class="cx">
</span><span class="cx"> if (mSupportsVertexTexture)
</span><span class="cx"> {
</span><del>- applyTextures(SAMPLER_VERTEX);
</del><ins>+ applyTextures(programBinary, SAMPLER_VERTEX);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// For each Direct3D 9 sampler of either the pixel or vertex stage,
</del><ins>+// For each Direct3D sampler of either the pixel or vertex stage,
</ins><span class="cx"> // looks up the corresponding OpenGL texture image unit and texture type,
</span><span class="cx"> // and sets the texture and its addressing/filtering state (or NULL when inactive).
</span><del>-void Context::applyTextures(SamplerType type)
</del><ins>+void Context::applyTextures(ProgramBinary *programBinary, SamplerType type)
</ins><span class="cx"> {
</span><del>- ProgramBinary *programBinary = getCurrentProgramBinary();
-
</del><span class="cx"> FramebufferTextureSerialSet boundFramebufferTextures = getBoundFramebufferTextureSerials();
</span><span class="cx">
</span><span class="cx"> // Range of Direct3D samplers of given sampler type
</span><span class="lines">@@ -1820,22 +2584,16 @@
</span><span class="cx">
</span><span class="cx"> for (int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
</span><span class="cx"> {
</span><del>- int textureUnit = programBinary->getSamplerMapping(type, samplerIndex); // OpenGL texture image unit index
-
- if (textureUnit != -1)
</del><ins>+ Texture *texture = NULL;
+ TextureType textureType;
+ SamplerState samplerState;
+ if (getCurrentTextureAndSamplerState(programBinary, type, samplerIndex, &texture, &textureType, &samplerState))
</ins><span class="cx"> {
</span><del>- TextureType textureType = programBinary->getSamplerTextureType(type, samplerIndex);
- Texture *texture = getSamplerTexture(textureUnit, textureType);
-
- if (texture->isSamplerComplete() &&
</del><ins>+ if (texture->isSamplerComplete(samplerState) &&
</ins><span class="cx"> boundFramebufferTextures.find(texture->getTextureSerial()) == boundFramebufferTextures.end())
</span><span class="cx"> {
</span><del>- SamplerState samplerState;
- texture->getSamplerState(&samplerState);
</del><span class="cx"> mRenderer->setSamplerState(type, samplerIndex, samplerState);
</span><del>-
</del><span class="cx"> mRenderer->setTexture(type, samplerIndex, texture);
</span><del>-
</del><span class="cx"> texture->resetDirty();
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -1855,69 +2613,114 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
</del><ins>+bool Context::applyUniformBuffers()
</ins><span class="cx"> {
</span><del>- Framebuffer *framebuffer = getReadFramebuffer();
</del><ins>+ Program *programObject = getProgram(mState.currentProgram);
+ ProgramBinary *programBinary = programObject->getProgramBinary();
</ins><span class="cx">
</span><del>- if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
</del><ins>+ std::vector<gl::Buffer*> boundBuffers;
+
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < programBinary->getActiveUniformBlockCount(); uniformBlockIndex++)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
</del><ins>+ GLuint blockBinding = programObject->getUniformBlockBinding(uniformBlockIndex);
+ const OffsetBindingPointer<Buffer>& boundBuffer = mState.uniformBuffers[blockBinding];
+ if (boundBuffer.id() == 0)
+ {
+ // undefined behaviour
+ return false;
+ }
+ else
+ {
+ gl::Buffer *uniformBuffer = boundBuffer.get();
+ ASSERT(uniformBuffer);
+ boundBuffers.push_back(uniformBuffer);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
</del><ins>+ return programBinary->applyUniformBuffers(boundBuffers);
+}
+
+bool Context::applyTransformFeedbackBuffers()
+{
+ TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused())
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ Buffer *transformFeedbackBuffers[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ GLintptr transformFeedbackOffsets[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ for (size_t i = 0; i < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ transformFeedbackBuffers[i] = mState.transformFeedbackBuffers[i].get();
+ transformFeedbackOffsets[i] = mState.transformFeedbackBuffers[i].getOffset();
+ }
+ mRenderer->applyTransformFeedbackBuffers(transformFeedbackBuffers, transformFeedbackOffsets);
+ return true;
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ return false;
+ }
+}
</ins><span class="cx">
</span><del>- GLsizei outputPitch = ComputePitch(width, ConvertSizedInternalFormat(format, type), getPackAlignment());
- // sized query sanity check
- if (bufSize)
</del><ins>+void Context::markTransformFeedbackUsage()
+{
+ for (size_t i = 0; i < IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
</ins><span class="cx"> {
</span><del>- int requiredSize = outputPitch * height;
- if (requiredSize > *bufSize)
</del><ins>+ Buffer *buffer = mState.transformFeedbackBuffers[i].get();
+ if (buffer)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ buffer->markTransformFeedbackUsage();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>-
- mRenderer->readPixels(framebuffer, x, y, width, height, format, type, outputPitch, getPackReverseRowOrder(), getPackAlignment(), pixels);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::clear(GLbitfield mask)
</span><span class="cx"> {
</span><del>- Framebuffer *framebufferObject = getDrawFramebuffer();
</del><ins>+ if (isRasterizerDiscardEnabled())
+ {
+ return;
+ }
</ins><span class="cx">
</span><del>- if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
</del><ins>+ ClearParameters clearParams = { 0 };
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
</del><ins>+ clearParams.clearColor[i] = false;
</ins><span class="cx"> }
</span><ins>+ 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;
</ins><span class="cx">
</span><del>- DWORD flags = 0;
- GLbitfield finalMask = 0;
-
</del><ins>+ Framebuffer *framebufferObject = getDrawFramebuffer();
</ins><span class="cx"> if (mask & GL_COLOR_BUFFER_BIT)
</span><span class="cx"> {
</span><del>- mask &= ~GL_COLOR_BUFFER_BIT;
-
</del><span class="cx"> if (framebufferObject->hasEnabledColorAttachment())
</span><span class="cx"> {
</span><del>- finalMask |= GL_COLOR_BUFFER_BIT;
</del><ins>+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = true;
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (mask & GL_DEPTH_BUFFER_BIT)
</span><span class="cx"> {
</span><del>- mask &= ~GL_DEPTH_BUFFER_BIT;
</del><span class="cx"> if (mState.depthStencil.depthMask && framebufferObject->getDepthbufferType() != GL_NONE)
</span><span class="cx"> {
</span><del>- finalMask |= GL_DEPTH_BUFFER_BIT;
</del><ins>+ clearParams.clearDepth = true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (mask & GL_STENCIL_BUFFER_BIT)
</span><span class="cx"> {
</span><del>- mask &= ~GL_STENCIL_BUFFER_BIT;
</del><span class="cx"> if (framebufferObject->getStencilbufferType() != GL_NONE)
</span><span class="cx"> {
</span><span class="cx"> rx::RenderTarget *depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
</span><span class="lines">@@ -1927,37 +2730,223 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (GetStencilSize(depthStencil->getActualFormat()) > 0)
</del><ins>+ if (gl::GetStencilBits(depthStencil->getActualFormat(), mClientVersion) > 0)
</ins><span class="cx"> {
</span><del>- finalMask |= GL_STENCIL_BUFFER_BIT;
</del><ins>+ clearParams.clearStencil = true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mask != 0)
</del><ins>+
+ if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ mRenderer->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 < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorFClearValue = ColorF(values[0], values[1], values[2], values[3]);
+ clearParams.colorClearType = GL_FLOAT;
+ }
+ else
+ {
+ for (unsigned int i = 0; i < 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;
+
</ins><span class="cx"> if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
</span><span class="cx"> {
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ClearParameters clearParams;
- clearParams.mask = finalMask;
- clearParams.colorClearValue = mState.colorClearValue;
</del><ins>+ mRenderer->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 < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorUIClearValue = ColorUI(values[0], values[1], values[2], values[3]);
+ clearParams.colorClearType = GL_UNSIGNED_INT;
</ins><span class="cx"> clearParams.colorMaskRed = mState.blend.colorMaskRed;
</span><span class="cx"> clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
</span><span class="cx"> clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
</span><span class="cx"> clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
</span><ins>+ clearParams.clearDepth = false;
</ins><span class="cx"> clearParams.depthClearValue = mState.depthClearValue;
</span><ins>+ clearParams.clearStencil = false;
</ins><span class="cx"> clearParams.stencilClearValue = mState.stencilClearValue;
</span><span class="cx"> clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
</span><ins>+ clearParams.scissorEnabled = mState.scissorTest;
+ clearParams.scissor = mState.scissor;
</ins><span class="cx">
</span><del>- mRenderer->clear(clearParams, framebufferObject);
</del><ins>+ if (!applyRenderTarget(GL_TRIANGLES, true)) // Clips the clear to the scissor rectangle but not the viewport
+ {
+ return;
+ }
+
+ mRenderer->clear(clearParams, getDrawFramebuffer());
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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 < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorIClearValue = ColorI(values[0], values[1], values[2], values[3]);
+ clearParams.colorClearType = GL_INT;
+ }
+ else
+ {
+ for (unsigned int i = 0; i < 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->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 < 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->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->readPixels(framebuffer, x, y, width, height, format, type, outputPitch, mState.pack, pixels);
+}
+
</ins><span class="cx"> void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
</span><span class="cx"> {
</span><span class="cx"> if (!mState.currentProgram)
</span><span class="lines">@@ -1965,6 +2954,11 @@
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ProgramBinary *programBinary = getCurrentProgramBinary();
+ programBinary->applyUniforms();
+
+ generateSwizzles(programBinary);
+
</ins><span class="cx"> if (!mRenderer->applyPrimitiveType(mode, count))
</span><span class="cx"> {
</span><span class="cx"> return;
</span><span class="lines">@@ -1977,17 +2971,22 @@
</span><span class="cx">
</span><span class="cx"> applyState(mode);
</span><span class="cx">
</span><del>- ProgramBinary *programBinary = getCurrentProgramBinary();
-
- GLenum err = mRenderer->applyVertexBuffer(programBinary, mState.vertexAttribute, first, count, instances);
</del><ins>+ GLenum err = mRenderer->applyVertexBuffer(programBinary, getCurrentVertexArray()->getVertexAttributes(), mState.vertexAttribCurrentValues, first, count, instances);
</ins><span class="cx"> if (err != GL_NO_ERROR)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(err);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- applyShaders();
- applyTextures();
</del><ins>+ bool transformFeedbackActive = applyTransformFeedbackBuffers();
</ins><span class="cx">
</span><ins>+ applyShaders(programBinary, transformFeedbackActive);
+ applyTextures(programBinary);
+
+ if (!applyUniformBuffers())
+ {
+ return;
+ }
+
</ins><span class="cx"> if (!programBinary->validateSamplers(NULL))
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="lines">@@ -1995,7 +2994,12 @@
</span><span class="cx">
</span><span class="cx"> if (!skipDraw(mode))
</span><span class="cx"> {
</span><del>- mRenderer->drawArrays(mode, count, instances);
</del><ins>+ mRenderer->drawArrays(mode, count, instances, transformFeedbackActive);
+
+ if (transformFeedbackActive)
+ {
+ markTransformFeedbackUsage();
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2006,11 +3010,17 @@
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!indices && !mState.elementArrayBuffer)
</del><ins>+ VertexArray *vao = getCurrentVertexArray();
+ if (!indices && !vao->getElementArrayBuffer())
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><del>-
</del><ins>+
+ ProgramBinary *programBinary = getCurrentProgramBinary();
+ programBinary->applyUniforms();
+
+ generateSwizzles(programBinary);
+
</ins><span class="cx"> if (!mRenderer->applyPrimitiveType(mode, count))
</span><span class="cx"> {
</span><span class="cx"> return;
</span><span class="lines">@@ -2024,24 +3034,32 @@
</span><span class="cx"> applyState(mode);
</span><span class="cx">
</span><span class="cx"> rx::TranslatedIndexData indexInfo;
</span><del>- GLenum err = mRenderer->applyIndexBuffer(indices, mState.elementArrayBuffer.get(), count, mode, type, &indexInfo);
</del><ins>+ GLenum err = mRenderer->applyIndexBuffer(indices, vao->getElementArrayBuffer(), count, mode, type, &indexInfo);
</ins><span class="cx"> if (err != GL_NO_ERROR)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(err);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ProgramBinary *programBinary = getCurrentProgramBinary();
-
</del><span class="cx"> GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
</span><del>- err = mRenderer->applyVertexBuffer(programBinary, mState.vertexAttribute, indexInfo.minIndex, vertexCount, instances);
</del><ins>+ err = mRenderer->applyVertexBuffer(programBinary, vao->getVertexAttributes(), mState.vertexAttribCurrentValues, indexInfo.minIndex, vertexCount, instances);
</ins><span class="cx"> if (err != GL_NO_ERROR)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(err);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- applyShaders();
- applyTextures();
</del><ins>+ bool transformFeedbackActive = applyTransformFeedbackBuffers();
+ // Transform feedback is not allowed for DrawElements, this error should have been caught at the API validation
+ // layer.
+ ASSERT(!transformFeedbackActive);
</ins><span class="cx">
</span><ins>+ applyShaders(programBinary, transformFeedbackActive);
+ applyTextures(programBinary);
+
+ if (!applyUniformBuffers())
+ {
+ return;
+ }
+
</ins><span class="cx"> if (!programBinary->validateSamplers(NULL))
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="lines">@@ -2049,7 +3067,7 @@
</span><span class="cx">
</span><span class="cx"> if (!skipDraw(mode))
</span><span class="cx"> {
</span><del>- mRenderer->drawElements(mode, count, type, indices, mState.elementArrayBuffer.get(), indexInfo, instances);
</del><ins>+ mRenderer->drawElements(mode, count, type, indices, vao->getElementArrayBuffer(), indexInfo, instances);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2155,6 +3173,11 @@
</span><span class="cx"> return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int Context::getClientVersion() const
+{
+ return mClientVersion;
+}
+
</ins><span class="cx"> int Context::getMajorShaderModel() const
</span><span class="cx"> {
</span><span class="cx"> return mMajorShaderModel;
</span><span class="lines">@@ -2170,11 +3193,43 @@
</span><span class="cx"> return mRenderer->getMaxCombinedTextureImageUnits();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned int Context::getMaximumCombinedUniformBufferBindings() const
+{
+ return mRenderer->getMaxVertexShaderUniformBuffers() +
+ mRenderer->getMaxFragmentShaderUniformBuffers();
+}
+
</ins><span class="cx"> int Context::getMaxSupportedSamples() const
</span><span class="cx"> {
</span><span class="cx"> return mRenderer->getMaxSupportedSamples();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLsizei Context::getMaxSupportedFormatSamples(GLenum internalFormat) const
+{
+ return mRenderer->getMaxSupportedFormatSamples(internalFormat);
+}
+
+GLsizei Context::getNumSampleCounts(GLenum internalFormat) const
+{
+ return mRenderer->getNumSampleCounts(internalFormat);
+}
+
+void Context::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
+{
+ mRenderer->getSampleCounts(internalFormat, bufSize, params);
+}
+
+unsigned int Context::getMaxTransformFeedbackBufferBindings() const
+{
+ return mRenderer->getMaxTransformFeedbackBuffers();
+}
+
+GLintptr Context::getUniformBufferOffsetAlignment() const
+{
+ // setting a large alignment forces uniform buffers to bind with zero offset
+ return static_cast<GLintptr>(std::numeric_limits<GLint>::max());
+}
+
</ins><span class="cx"> unsigned int Context::getMaximumRenderTargets() const
</span><span class="cx"> {
</span><span class="cx"> return mRenderer->getMaxRenderTargets();
</span><span class="lines">@@ -2245,9 +3300,9 @@
</span><span class="cx"> return mMaxRenderbufferDimension;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-int Context::getMaximumTextureDimension() const
</del><ins>+int Context::getMaximum2DTextureDimension() const
</ins><span class="cx"> {
</span><del>- return mMaxTextureDimension;
</del><ins>+ return mMax2DTextureDimension;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int Context::getMaximumCubeTextureDimension() const
</span><span class="lines">@@ -2255,11 +3310,36 @@
</span><span class="cx"> return mMaxCubeTextureDimension;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-int Context::getMaximumTextureLevel() const
</del><ins>+int Context::getMaximum3DTextureDimension() const
</ins><span class="cx"> {
</span><del>- return mMaxTextureLevel;
</del><ins>+ return mMax3DTextureDimension;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> bool Context::supportsLuminanceTextures() const
</span><span class="cx"> {
</span><span class="cx"> return mSupportsLuminanceTextures;
</span><span class="lines">@@ -2270,6 +3350,11 @@
</span><span class="cx"> return mSupportsLuminanceAlphaTextures;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Context::supportsRGTextures() const
+{
+ return mSupportsRGTextures;
+}
+
</ins><span class="cx"> bool Context::supportsDepthTextures() const
</span><span class="cx"> {
</span><span class="cx"> return mSupportsDepthTextures;
</span><span class="lines">@@ -2295,12 +3380,17 @@
</span><span class="cx"> return mSupportsTextureFilterAnisotropy;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Context::supportsPBOs() const
+{
+ return mSupportsPBOs;
+}
+
</ins><span class="cx"> float Context::getTextureMaxAnisotropy() const
</span><span class="cx"> {
</span><span class="cx"> return mMaxTextureAnisotropy;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Context::getCurrentReadFormatType(GLenum *format, GLenum *type)
</del><ins>+bool Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type)
</ins><span class="cx"> {
</span><span class="cx"> Framebuffer *framebuffer = getReadFramebuffer();
</span><span class="cx"> if (!framebuffer || framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
</span><span class="lines">@@ -2314,8 +3404,9 @@
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- *format = gl::ExtractFormat(renderbuffer->getActualFormat());
- *type = gl::ExtractType(renderbuffer->getActualFormat());
</del><ins>+ *internalFormat = renderbuffer->getActualFormat();
+ *format = gl::GetFormat(renderbuffer->getActualFormat(), mClientVersion);
+ *type = gl::GetType(renderbuffer->getActualFormat(), mClientVersion);
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -2331,18 +3422,11 @@
</span><span class="cx"> mState.arrayBuffer.set(NULL);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mState.elementArrayBuffer.id() == buffer)
</del><ins>+ // mark as freed among the vertex array objects
+ for (auto vaoIt = mVertexArrayMap.begin(); vaoIt != mVertexArrayMap.end(); vaoIt++)
</ins><span class="cx"> {
</span><del>- mState.elementArrayBuffer.set(NULL);
</del><ins>+ vaoIt->second->detachBuffer(buffer);
</ins><span class="cx"> }
</span><del>-
- for (int attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
- {
- if (mState.vertexAttribute[attribute].mBoundBuffer.id() == buffer)
- {
- mState.vertexAttribute[attribute].mBoundBuffer.set(NULL);
- }
- }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Context::detachTexture(GLuint texture)
</span><span class="lines">@@ -2428,13 +3512,48 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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 < ArraySize(mState.samplers); textureUnit++)
+ {
+ if (mState.samplers[textureUnit] == sampler)
+ {
+ mState.samplers[textureUnit] = 0;
+ }
+ }
+}
+
</ins><span class="cx"> Texture *Context::getIncompleteTexture(TextureType type)
</span><span class="cx"> {
</span><span class="cx"> Texture *t = mIncompleteTextures[type].get();
</span><span class="cx">
</span><span class="cx"> if (t == NULL)
</span><span class="cx"> {
</span><del>- static const GLubyte color[] = { 0, 0, 0, 255 };
</del><ins>+ const GLubyte color[] = { 0, 0, 0, 255 };
+ const PixelUnpackState incompleteUnpackState(1);
</ins><span class="cx">
</span><span class="cx"> switch (type)
</span><span class="cx"> {
</span><span class="lines">@@ -2445,7 +3564,7 @@
</span><span class="cx"> case TEXTURE_2D:
</span><span class="cx"> {
</span><span class="cx"> Texture2D *incomplete2d = new Texture2D(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
</span><del>- incomplete2d->setImage(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
</del><ins>+ incomplete2d->setImage(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
</ins><span class="cx"> t = incomplete2d;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="lines">@@ -2454,16 +3573,34 @@
</span><span class="cx"> {
</span><span class="cx"> TextureCubeMap *incompleteCube = new TextureCubeMap(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
</span><span class="cx">
</span><del>- incompleteCube->setImagePosX(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImageNegX(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImagePosY(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImageNegY(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImagePosZ(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
- incompleteCube->setImageNegZ(0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, color);
</del><ins>+ incompleteCube->setImagePosX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImageNegX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImagePosY(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImageNegY(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImagePosZ(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+ incompleteCube->setImageNegZ(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
</ins><span class="cx">
</span><span class="cx"> t = incompleteCube;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+
+ case TEXTURE_3D:
+ {
+ Texture3D *incomplete3d = new Texture3D(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
+ incomplete3d->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->setImage(0, 1, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+
+ t = incomplete2darray;
+ }
+ break;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mIncompleteTextures[type].set(t);
</span><span class="lines">@@ -2499,150 +3636,285 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Context::setVertexAttrib(GLuint index, const GLfloat *values)
</del><ins>+void Context::setVertexAttribf(GLuint index, const GLfloat values[4])
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
</span><ins>+ mState.vertexAttribCurrentValues[index].setFloatValues(values);
+}
</ins><span class="cx">
</span><del>- mState.vertexAttribute[index].mCurrentValue[0] = values[0];
- mState.vertexAttribute[index].mCurrentValue[1] = values[1];
- mState.vertexAttribute[index].mCurrentValue[2] = values[2];
- mState.vertexAttribute[index].mCurrentValue[3] = values[3];
</del><ins>+void Context::setVertexAttribu(GLuint index, const GLuint values[4])
+{
+ ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
+ mState.vertexAttribCurrentValues[index].setUnsignedIntValues(values);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
</del><ins>+void Context::setVertexAttribi(GLuint index, const GLint values[4])
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
</span><ins>+ mState.vertexAttribCurrentValues[index].setIntValues(values);
+}
</ins><span class="cx">
</span><del>- mState.vertexAttribute[index].mDivisor = divisor;
</del><ins>+void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ getCurrentVertexArray()->setVertexAttribDivisor(index, divisor);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// keep list sorted in following order
-// OES extensions
-// EXT extensions
-// Vendor extensions
-void Context::initExtensionString()
</del><ins>+void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
</ins><span class="cx"> {
</span><del>- std::string extensionString = "";
</del><ins>+ mResourceManager->checkSamplerAllocation(sampler);
</ins><span class="cx">
</span><del>- // OES extensions
- if (supports32bitIndices())
- {
- extensionString += "GL_OES_element_index_uint ";
- }
</del><ins>+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
</ins><span class="cx">
</span><del>- extensionString += "GL_OES_packed_depth_stencil ";
- extensionString += "GL_OES_get_program_binary ";
- extensionString += "GL_OES_rgb8_rgba8 ";
- if (mRenderer->getDerivativeInstructionSupport())
</del><ins>+ switch (pname)
</ins><span class="cx"> {
</span><del>- extensionString += "GL_OES_standard_derivatives ";
</del><ins>+ case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(static_cast<GLfloat>(param)); break;
+ case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(static_cast<GLfloat>(param)); break;
+ case GL_TEXTURE_COMPARE_MODE: samplerObject->setComparisonMode(static_cast<GLenum>(param)); break;
+ case GL_TEXTURE_COMPARE_FUNC: samplerObject->setComparisonFunc(static_cast<GLenum>(param)); break;
+ default: UNREACHABLE(); break;
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- if (supportsFloat16Textures())
- {
- extensionString += "GL_OES_texture_half_float ";
- }
- if (supportsFloat16LinearFilter())
- {
- extensionString += "GL_OES_texture_half_float_linear ";
- }
- if (supportsFloat32Textures())
- {
- extensionString += "GL_OES_texture_float ";
- }
- if (supportsFloat32LinearFilter())
- {
- extensionString += "GL_OES_texture_float_linear ";
- }
</del><ins>+void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ mResourceManager->checkSamplerAllocation(sampler);
</ins><span class="cx">
</span><del>- if (supportsNonPower2Texture())
- {
- extensionString += "GL_OES_texture_npot ";
- }
</del><ins>+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
</ins><span class="cx">
</span><del>- // Multi-vendor (EXT) extensions
- if (supportsOcclusionQueries())
</del><ins>+ switch (pname)
</ins><span class="cx"> {
</span><del>- extensionString += "GL_EXT_occlusion_query_boolean ";
</del><ins>+ case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(param); break;
+ case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(param); break;
+ case GL_TEXTURE_COMPARE_MODE: samplerObject->setComparisonMode(uiround<GLenum>(param)); break;
+ case GL_TEXTURE_COMPARE_FUNC: samplerObject->setComparisonFunc(uiround<GLenum>(param)); break;
+ default: UNREACHABLE(); break;
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- extensionString += "GL_EXT_read_format_bgra ";
- extensionString += "GL_EXT_robustness ";
</del><ins>+GLint Context::getSamplerParameteri(GLuint sampler, GLenum pname)
+{
+ mResourceManager->checkSamplerAllocation(sampler);
</ins><span class="cx">
</span><del>- if (supportsDXT1Textures())
- {
- extensionString += "GL_EXT_texture_compression_dxt1 ";
- }
</del><ins>+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
</ins><span class="cx">
</span><del>- if (supportsTextureFilterAnisotropy())
</del><ins>+ switch (pname)
</ins><span class="cx"> {
</span><del>- extensionString += "GL_EXT_texture_filter_anisotropic ";
</del><ins>+ case GL_TEXTURE_MIN_FILTER: return static_cast<GLint>(samplerObject->getMinFilter());
+ case GL_TEXTURE_MAG_FILTER: return static_cast<GLint>(samplerObject->getMagFilter());
+ case GL_TEXTURE_WRAP_S: return static_cast<GLint>(samplerObject->getWrapS());
+ case GL_TEXTURE_WRAP_T: return static_cast<GLint>(samplerObject->getWrapT());
+ case GL_TEXTURE_WRAP_R: return static_cast<GLint>(samplerObject->getWrapR());
+ case GL_TEXTURE_MIN_LOD: return uiround<GLint>(samplerObject->getMinLod());
+ case GL_TEXTURE_MAX_LOD: return uiround<GLint>(samplerObject->getMaxLod());
+ case GL_TEXTURE_COMPARE_MODE: return static_cast<GLint>(samplerObject->getComparisonMode());
+ case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLint>(samplerObject->getComparisonFunc());
+ default: UNREACHABLE(); return 0;
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- if (supportsBGRATextures())
</del><ins>+GLfloat Context::getSamplerParameterf(GLuint sampler, GLenum pname)
+{
+ mResourceManager->checkSamplerAllocation(sampler);
+
+ Sampler *samplerObject = getSampler(sampler);
+ ASSERT(samplerObject);
+
+ switch (pname)
</ins><span class="cx"> {
</span><del>- extensionString += "GL_EXT_texture_format_BGRA8888 ";
</del><ins>+ case GL_TEXTURE_MIN_FILTER: return static_cast<GLfloat>(samplerObject->getMinFilter());
+ case GL_TEXTURE_MAG_FILTER: return static_cast<GLfloat>(samplerObject->getMagFilter());
+ case GL_TEXTURE_WRAP_S: return static_cast<GLfloat>(samplerObject->getWrapS());
+ case GL_TEXTURE_WRAP_T: return static_cast<GLfloat>(samplerObject->getWrapT());
+ case GL_TEXTURE_WRAP_R: return static_cast<GLfloat>(samplerObject->getWrapR());
+ case GL_TEXTURE_MIN_LOD: return samplerObject->getMinLod();
+ case GL_TEXTURE_MAX_LOD: return samplerObject->getMaxLod();
+ case GL_TEXTURE_COMPARE_MODE: return static_cast<GLfloat>(samplerObject->getComparisonMode());
+ case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLfloat>(samplerObject->getComparisonFunc());
+ default: UNREACHABLE(); return 0;
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- if (mRenderer->getMaxRenderTargets() > 1)
</del><ins>+// 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)
</ins><span class="cx"> {
</span><del>- extensionString += "GL_EXT_draw_buffers ";
- }
</del><ins>+ // OES extensions
+ if (supports32bitIndices())
+ {
+ mExtensionStringList.push_back("GL_OES_element_index_uint");
+ }
</ins><span class="cx">
</span><del>- extensionString += "GL_EXT_texture_storage ";
- extensionString += "GL_EXT_frag_depth ";
</del><ins>+ mExtensionStringList.push_back("GL_OES_packed_depth_stencil");
+ mExtensionStringList.push_back("GL_OES_get_program_binary");
+ mExtensionStringList.push_back("GL_OES_rgb8_rgba8");
</ins><span class="cx">
</span><del>- // ANGLE-specific extensions
- if (supportsDepthTextures())
- {
- extensionString += "GL_ANGLE_depth_texture ";
- }
</del><ins>+ if (supportsPBOs())
+ {
+ mExtensionStringList.push_back("GL_OES_mapbuffer");
+ mExtensionStringList.push_back("GL_EXT_map_buffer_range");
+ }
</ins><span class="cx">
</span><del>- extensionString += "GL_ANGLE_framebuffer_blit ";
- if (getMaxSupportedSamples() != 0)
- {
- extensionString += "GL_ANGLE_framebuffer_multisample ";
- }
</del><ins>+ if (mRenderer->getDerivativeInstructionSupport())
+ {
+ mExtensionStringList.push_back("GL_OES_standard_derivatives");
+ }
</ins><span class="cx">
</span><del>- if (supportsInstancing())
- {
- extensionString += "GL_ANGLE_instanced_arrays ";
- }
</del><ins>+ if (supportsFloat16Textures())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_half_float");
+ }
+ if (supportsFloat16LinearFilter())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_half_float_linear");
+ }
+ if (supportsFloat32Textures())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_float");
+ }
+ if (supportsFloat32LinearFilter())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_float_linear");
+ }
</ins><span class="cx">
</span><del>- extensionString += "GL_ANGLE_pack_reverse_row_order ";
</del><ins>+ if (supportsRGTextures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_rg");
+ }
</ins><span class="cx">
</span><del>- if (supportsDXT3Textures())
- {
- extensionString += "GL_ANGLE_texture_compression_dxt3 ";
</del><ins>+ if (supportsNonPower2Texture())
+ {
+ mExtensionStringList.push_back("GL_OES_texture_npot");
+ }
+
+ // Multi-vendor (EXT) extensions
+ if (supportsOcclusionQueries())
+ {
+ mExtensionStringList.push_back("GL_EXT_occlusion_query_boolean");
+ }
+
+ mExtensionStringList.push_back("GL_EXT_read_format_bgra");
+ mExtensionStringList.push_back("GL_EXT_robustness");
+ mExtensionStringList.push_back("GL_EXT_shader_texture_lod");
+
+ if (supportsDXT1Textures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_compression_dxt1");
+ }
+
+ if (supportsTextureFilterAnisotropy())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_filter_anisotropic");
+ }
+
+ if (supportsBGRATextures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_format_BGRA8888");
+ }
+
+ if (mRenderer->getMaxRenderTargets() > 1)
+ {
+ mExtensionStringList.push_back("GL_EXT_draw_buffers");
+ }
+
+ mExtensionStringList.push_back("GL_EXT_texture_storage");
+ mExtensionStringList.push_back("GL_EXT_frag_depth");
+ mExtensionStringList.push_back("GL_EXT_blend_minmax");
+
+ // ANGLE-specific extensions
+ if (supportsDepthTextures())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_depth_texture");
+ }
+
+ mExtensionStringList.push_back("GL_ANGLE_framebuffer_blit");
+ if (getMaxSupportedSamples() != 0)
+ {
+ mExtensionStringList.push_back("GL_ANGLE_framebuffer_multisample");
+ }
+
+ if (supportsInstancing())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_instanced_arrays");
+ }
+
+ mExtensionStringList.push_back("GL_ANGLE_pack_reverse_row_order");
+
+ if (supportsDXT3Textures())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_texture_compression_dxt3");
+ }
+ if (supportsDXT5Textures())
+ {
+ mExtensionStringList.push_back("GL_ANGLE_texture_compression_dxt5");
+ }
+
+ mExtensionStringList.push_back("GL_ANGLE_texture_usage");
+ mExtensionStringList.push_back("GL_ANGLE_translated_shader_source");
+
+ // Other vendor-specific extensions
+ if (supportsEventQueries())
+ {
+ mExtensionStringList.push_back("GL_NV_fence");
+ }
</ins><span class="cx"> }
</span><del>- if (supportsDXT5Textures())
</del><ins>+
+ if (mClientVersion == 3)
</ins><span class="cx"> {
</span><del>- extensionString += "GL_ANGLE_texture_compression_dxt5 ";
- }
</del><ins>+ mExtensionStringList.push_back("GL_EXT_color_buffer_float");
</ins><span class="cx">
</span><del>- extensionString += "GL_ANGLE_texture_usage ";
- extensionString += "GL_ANGLE_translated_shader_source ";
</del><ins>+ mExtensionStringList.push_back("GL_EXT_read_format_bgra");
</ins><span class="cx">
</span><del>- // Other vendor-specific extensions
- if (supportsEventQueries())
- {
- extensionString += "GL_NV_fence ";
</del><ins>+ if (supportsBGRATextures())
+ {
+ mExtensionStringList.push_back("GL_EXT_texture_format_BGRA8888");
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- std::string::size_type end = extensionString.find_last_not_of(' ');
- if (end != std::string::npos)
</del><ins>+ // Join the extension strings to one long string for use with GetString
+ std::stringstream strstr;
+ for (unsigned int extensionIndex = 0; extensionIndex < mExtensionStringList.size(); extensionIndex++)
</ins><span class="cx"> {
</span><del>- extensionString.resize(end+1);
</del><ins>+ strstr << mExtensionStringList[extensionIndex];
+ strstr << " ";
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- mExtensionString = makeStaticString(extensionString);
</del><ins>+ mCombinedExtensionsString = makeStaticString(strstr.str());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-const char *Context::getExtensionString() const
</del><ins>+const char *Context::getCombinedExtensionsString() const
</ins><span class="cx"> {
</span><del>- return mExtensionString;
</del><ins>+ return mCombinedExtensionsString;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+const char *Context::getExtensionString(const GLuint index) const
+{
+ ASSERT(index < mExtensionStringList.size());
+ return mExtensionStringList[index].c_str();
+}
+
+unsigned int Context::getNumExtensions() const
+{
+ return mExtensionStringList.size();
+}
+
</ins><span class="cx"> void Context::initRendererString()
</span><span class="cx"> {
</span><span class="cx"> std::ostringstream rendererString;
</span><span class="lines">@@ -2681,298 +3953,145 @@
</span><span class="cx"> return set;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask)
</del><ins>+void Context::blitFramebuffer(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><span class="cx"> Framebuffer *readFramebuffer = getReadFramebuffer();
</span><span class="cx"> Framebuffer *drawFramebuffer = getDrawFramebuffer();
</span><span class="cx">
</span><del>- if (!readFramebuffer || readFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE ||
- !drawFramebuffer || drawFramebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
</del><ins>+ bool blitRenderTarget = false;
+ bool blitDepth = false;
+ bool blitStencil = false;
+ if ((mask & GL_COLOR_BUFFER_BIT) && readFramebuffer->getReadColorbuffer() && drawFramebuffer->getFirstColorbuffer())
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
</del><ins>+ blitRenderTarget = true;
</ins><span class="cx"> }
</span><del>-
- if (drawFramebuffer->getSamples() != 0)
</del><ins>+ if ((mask & GL_STENCIL_BUFFER_BIT) && readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer())
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ blitStencil = true;
</ins><span class="cx"> }
</span><del>-
- Renderbuffer *readColorBuffer = readFramebuffer->getReadColorbuffer();
- Renderbuffer *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
-
- if (drawColorBuffer == NULL)
</del><ins>+ if ((mask & GL_DEPTH_BUFFER_BIT) && readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer())
</ins><span class="cx"> {
</span><del>- ERR("Draw buffers formats don't match, which is not supported in this implementation of BlitFramebufferANGLE");
- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ blitDepth = true;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- int readBufferWidth = readColorBuffer->getWidth();
- int readBufferHeight = readColorBuffer->getHeight();
- int drawBufferWidth = drawColorBuffer->getWidth();
- int drawBufferHeight = drawColorBuffer->getHeight();
-
- Rectangle sourceRect;
- Rectangle destRect;
-
- if (srcX0 < srcX1)
</del><ins>+ gl::Rectangle srcRect(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
+ gl::Rectangle dstRect(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
+ if (blitRenderTarget || blitDepth || blitStencil)
</ins><span class="cx"> {
</span><del>- sourceRect.x = srcX0;
- destRect.x = dstX0;
- sourceRect.width = srcX1 - srcX0;
- destRect.width = dstX1 - dstX0;
</del><ins>+ const gl::Rectangle *scissor = mState.scissorTest ? &mState.scissor : NULL;
+ mRenderer->blitRect(readFramebuffer, srcRect, drawFramebuffer, dstRect, scissor,
+ blitRenderTarget, blitDepth, blitStencil, filter);
</ins><span class="cx"> }
</span><del>- else
- {
- sourceRect.x = srcX1;
- destRect.x = dstX1;
- sourceRect.width = srcX0 - srcX1;
- destRect.width = dstX0 - dstX1;
- }
</del><ins>+}
</ins><span class="cx">
</span><del>- if (srcY0 < srcY1)
</del><ins>+void Context::invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
+ GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ Framebuffer *frameBuffer = NULL;
+ switch (target)
</ins><span class="cx"> {
</span><del>- sourceRect.height = srcY1 - srcY0;
- destRect.height = dstY1 - dstY0;
- sourceRect.y = srcY0;
- destRect.y = dstY0;
</del><ins>+ case GL_FRAMEBUFFER:
+ case GL_DRAW_FRAMEBUFFER:
+ frameBuffer = getDrawFramebuffer();
+ break;
+ case GL_READ_FRAMEBUFFER:
+ frameBuffer = getReadFramebuffer();
+ break;
+ default:
+ UNREACHABLE();
</ins><span class="cx"> }
</span><del>- else
- {
- sourceRect.height = srcY0 - srcY1;
- destRect.height = dstY0 - srcY1;
- sourceRect.y = srcY1;
- destRect.y = dstY1;
- }
</del><span class="cx">
</span><del>- Rectangle sourceScissoredRect = sourceRect;
- Rectangle destScissoredRect = destRect;
-
- if (mState.scissorTest)
</del><ins>+ if (frameBuffer && frameBuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
</ins><span class="cx"> {
</span><del>- // Only write to parts of the destination framebuffer which pass the scissor test.
- if (destRect.x < mState.scissor.x)
</del><ins>+ for (int i = 0; i < numAttachments; ++i)
</ins><span class="cx"> {
</span><del>- int xDiff = mState.scissor.x - destRect.x;
- destScissoredRect.x = mState.scissor.x;
- destScissoredRect.width -= xDiff;
- sourceScissoredRect.x += xDiff;
- sourceScissoredRect.width -= xDiff;
</del><ins>+ rx::RenderTarget *renderTarget = NULL;
</ins><span class="cx">
</span><del>- }
-
- if (destRect.x + destRect.width > mState.scissor.x + mState.scissor.width)
- {
- int xDiff = (destRect.x + destRect.width) - (mState.scissor.x + mState.scissor.width);
- destScissoredRect.width -= xDiff;
- sourceScissoredRect.width -= xDiff;
- }
-
- if (destRect.y < mState.scissor.y)
- {
- int yDiff = mState.scissor.y - destRect.y;
- destScissoredRect.y = mState.scissor.y;
- destScissoredRect.height -= yDiff;
- sourceScissoredRect.y += yDiff;
- sourceScissoredRect.height -= yDiff;
- }
-
- if (destRect.y + destRect.height > mState.scissor.y + mState.scissor.height)
- {
- int yDiff = (destRect.y + destRect.height) - (mState.scissor.y + mState.scissor.height);
- destScissoredRect.height -= yDiff;
- sourceScissoredRect.height -= yDiff;
- }
- }
-
- bool blitRenderTarget = false;
- bool blitDepthStencil = false;
-
- Rectangle sourceTrimmedRect = sourceScissoredRect;
- Rectangle destTrimmedRect = destScissoredRect;
-
- // The source & destination rectangles also may need to be trimmed if they fall out of the bounds of
- // the actual draw and read surfaces.
- if (sourceTrimmedRect.x < 0)
- {
- int xDiff = 0 - sourceTrimmedRect.x;
- sourceTrimmedRect.x = 0;
- sourceTrimmedRect.width -= xDiff;
- destTrimmedRect.x += xDiff;
- destTrimmedRect.width -= xDiff;
- }
-
- if (sourceTrimmedRect.x + sourceTrimmedRect.width > readBufferWidth)
- {
- int xDiff = (sourceTrimmedRect.x + sourceTrimmedRect.width) - readBufferWidth;
- sourceTrimmedRect.width -= xDiff;
- destTrimmedRect.width -= xDiff;
- }
-
- if (sourceTrimmedRect.y < 0)
- {
- int yDiff = 0 - sourceTrimmedRect.y;
- sourceTrimmedRect.y = 0;
- sourceTrimmedRect.height -= yDiff;
- destTrimmedRect.y += yDiff;
- destTrimmedRect.height -= yDiff;
- }
-
- if (sourceTrimmedRect.y + sourceTrimmedRect.height > readBufferHeight)
- {
- int yDiff = (sourceTrimmedRect.y + sourceTrimmedRect.height) - readBufferHeight;
- sourceTrimmedRect.height -= yDiff;
- destTrimmedRect.height -= yDiff;
- }
-
- if (destTrimmedRect.x < 0)
- {
- int xDiff = 0 - destTrimmedRect.x;
- destTrimmedRect.x = 0;
- destTrimmedRect.width -= xDiff;
- sourceTrimmedRect.x += xDiff;
- sourceTrimmedRect.width -= xDiff;
- }
-
- if (destTrimmedRect.x + destTrimmedRect.width > drawBufferWidth)
- {
- int xDiff = (destTrimmedRect.x + destTrimmedRect.width) - drawBufferWidth;
- destTrimmedRect.width -= xDiff;
- sourceTrimmedRect.width -= xDiff;
- }
-
- if (destTrimmedRect.y < 0)
- {
- int yDiff = 0 - destTrimmedRect.y;
- destTrimmedRect.y = 0;
- destTrimmedRect.height -= yDiff;
- sourceTrimmedRect.y += yDiff;
- sourceTrimmedRect.height -= yDiff;
- }
-
- if (destTrimmedRect.y + destTrimmedRect.height > drawBufferHeight)
- {
- int yDiff = (destTrimmedRect.y + destTrimmedRect.height) - drawBufferHeight;
- destTrimmedRect.height -= yDiff;
- sourceTrimmedRect.height -= yDiff;
- }
-
- bool partialBufferCopy = false;
- if (sourceTrimmedRect.height < readBufferHeight ||
- sourceTrimmedRect.width < readBufferWidth ||
- destTrimmedRect.height < drawBufferHeight ||
- destTrimmedRect.width < drawBufferWidth ||
- sourceTrimmedRect.y != 0 || destTrimmedRect.y != 0 || sourceTrimmedRect.x != 0 || destTrimmedRect.x != 0)
- {
- partialBufferCopy = true;
- }
-
- if (mask & GL_COLOR_BUFFER_BIT)
- {
- const GLenum readColorbufferType = readFramebuffer->getReadColorbufferType();
- const bool validReadType = (readColorbufferType == GL_TEXTURE_2D) || (readColorbufferType == GL_RENDERBUFFER);
- bool validDrawType = true;
- bool validDrawFormat = true;
-
- for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
- {
- if (drawFramebuffer->isEnabledColorAttachment(colorAttachment))
</del><ins>+ if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT15)
</ins><span class="cx"> {
</span><del>- if (drawFramebuffer->getColorbufferType(colorAttachment) != GL_TEXTURE_2D &&
- drawFramebuffer->getColorbufferType(colorAttachment) != GL_RENDERBUFFER)
</del><ins>+ gl::Renderbuffer *renderBuffer = frameBuffer->getColorbuffer(attachments[i] - GL_COLOR_ATTACHMENT0);
+ if (renderBuffer)
</ins><span class="cx"> {
</span><del>- validDrawType = false;
</del><ins>+ renderTarget = renderBuffer->getRenderTarget();
</ins><span class="cx"> }
</span><ins>+ }
+ else if (attachments[i] == GL_COLOR)
+ {
+ gl::Renderbuffer *renderBuffer = frameBuffer->getColorbuffer(0);
+ if (renderBuffer)
+ {
+ renderTarget = renderBuffer->getRenderTarget();
+ }
+ }
+ else
+ {
+ gl::Renderbuffer *renderBuffer = NULL;
+ switch (attachments[i])
+ {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_DEPTH:
+ renderBuffer = frameBuffer->getDepthbuffer();
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ case GL_STENCIL:
+ renderBuffer = frameBuffer->getStencilbuffer();
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ renderBuffer = frameBuffer->getDepthOrStencilbuffer();
+ break;
+ default:
+ UNREACHABLE();
+ }
</ins><span class="cx">
</span><del>- if (drawFramebuffer->getColorbuffer(colorAttachment)->getActualFormat() != readColorBuffer->getActualFormat())
</del><ins>+ if (renderBuffer)
</ins><span class="cx"> {
</span><del>- validDrawFormat = false;
</del><ins>+ renderTarget = renderBuffer->getDepthStencil();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- }
</del><span class="cx">
</span><del>- if (!validReadType || !validDrawType || !validDrawFormat)
- {
- ERR("Color buffer format conversion in BlitFramebufferANGLE not supported by this implementation");
- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ if (renderTarget)
+ {
+ renderTarget->invalidate(x, y, width, height);
+ }
</ins><span class="cx"> }
</span><del>-
- if (partialBufferCopy && readFramebuffer->getSamples() != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- blitRenderTarget = true;
-
</del><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- if (mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT))
</del><ins>+bool Context::hasMappedBuffer(GLenum target) const
+{
+ if (target == GL_ARRAY_BUFFER)
</ins><span class="cx"> {
</span><del>- Renderbuffer *readDSBuffer = NULL;
- Renderbuffer *drawDSBuffer = NULL;
-
- // We support OES_packed_depth_stencil, and do not support a separately attached depth and stencil buffer, so if we have
- // both a depth and stencil buffer, it will be the same buffer.
-
- if (mask & GL_DEPTH_BUFFER_BIT)
</del><ins>+ for (unsigned int attribIndex = 0; attribIndex < gl::MAX_VERTEX_ATTRIBS; attribIndex++)
</ins><span class="cx"> {
</span><del>- if (readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer())
</del><ins>+ const gl::VertexAttribute &vertexAttrib = getVertexAttribState(attribIndex);
+ gl::Buffer *boundBuffer = vertexAttrib.mBoundBuffer.get();
+ if (vertexAttrib.mArrayEnabled && boundBuffer && boundBuffer->mapped())
</ins><span class="cx"> {
</span><del>- if (readFramebuffer->getDepthbufferType() != drawFramebuffer->getDepthbufferType() ||
- readFramebuffer->getDepthbuffer()->getActualFormat() != drawFramebuffer->getDepthbuffer()->getActualFormat())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- blitDepthStencil = true;
- readDSBuffer = readFramebuffer->getDepthbuffer();
- drawDSBuffer = drawFramebuffer->getDepthbuffer();
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>-
- if (mask & GL_STENCIL_BUFFER_BIT)
- {
- if (readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer())
- {
- if (readFramebuffer->getStencilbufferType() != drawFramebuffer->getStencilbufferType() ||
- readFramebuffer->getStencilbuffer()->getActualFormat() != drawFramebuffer->getStencilbuffer()->getActualFormat())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- blitDepthStencil = true;
- readDSBuffer = readFramebuffer->getStencilbuffer();
- drawDSBuffer = drawFramebuffer->getStencilbuffer();
- }
- }
-
- if (partialBufferCopy)
- {
- ERR("Only whole-buffer depth and stencil blits are supported by this implementation.");
- return gl::error(GL_INVALID_OPERATION); // only whole-buffer copies are permitted
- }
-
- if ((drawDSBuffer && drawDSBuffer->getSamples() != 0) ||
- (readDSBuffer && readDSBuffer->getSamples() != 0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><span class="cx"> }
</span><del>-
- if (blitRenderTarget || blitDepthStencil)
</del><ins>+ else if (target == GL_ELEMENT_ARRAY_BUFFER)
</ins><span class="cx"> {
</span><del>- mRenderer->blitRect(readFramebuffer, sourceTrimmedRect, drawFramebuffer, destTrimmedRect, blitRenderTarget, blitDepthStencil);
</del><ins>+ Buffer *elementBuffer = getElementArrayBuffer();
+ return (elementBuffer && elementBuffer->mapped());
</ins><span class="cx"> }
</span><ins>+ else if (target == GL_TRANSFORM_FEEDBACK_BUFFER)
+ {
+ UNIMPLEMENTED();
+ }
+ else UNREACHABLE();
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> extern "C"
</span><span class="cx"> {
</span><del>-gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
</del><ins>+gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
</ins><span class="cx"> {
</span><del>- return new gl::Context(shareContext, renderer, notifyResets, robustAccess);
</del><ins>+ return new gl::Context(clientVersion, shareContext, renderer, notifyResets, robustAccess);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void glDestroyContext(gl::Context *context)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Contexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h        2014-04-30 22:57:08 UTC (rev 168055)
</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">@@ -10,26 +10,27 @@
</span><span class="cx"> #ifndef LIBGLESV2_CONTEXT_H_
</span><span class="cx"> #define LIBGLESV2_CONTEXT_H_
</span><span class="cx">
</span><ins>+#ifndef GL_APICALL
</ins><span class="cx"> #define GL_APICALL
</span><ins>+#endif
+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx"> #include <GLES2/gl2ext.h>
</span><span class="cx"> #define EGLAPI
</span><span class="cx"> #include <EGL/egl.h>
</span><span class="cx">
</span><span class="cx"> #include <string>
</span><ins>+#include <set>
</ins><span class="cx"> #include <map>
</span><del>-#include <set>
-#ifdef _MSC_VER
-#include <hash_map>
-#else
</del><span class="cx"> #include <unordered_map>
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><span class="cx"> #include "common/RefCountObject.h"
</span><span class="cx"> #include "libGLESv2/HandleAllocator.h"
</span><span class="cx"> #include "libGLESv2/angletypes.h"
</span><span class="cx"> #include "libGLESv2/Constants.h"
</span><ins>+#include "libGLESv2/VertexAttribute.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -49,6 +50,8 @@
</span><span class="cx"> class Texture;
</span><span class="cx"> class Texture2D;
</span><span class="cx"> class TextureCubeMap;
</span><ins>+class Texture3D;
+class Texture2DArray;
</ins><span class="cx"> class Framebuffer;
</span><span class="cx"> class Renderbuffer;
</span><span class="cx"> class RenderbufferStorage;
</span><span class="lines">@@ -56,73 +59,20 @@
</span><span class="cx"> class Depthbuffer;
</span><span class="cx"> class Stencilbuffer;
</span><span class="cx"> class DepthStencilbuffer;
</span><del>-class Fence;
</del><ins>+class FenceNV;
+class FenceSync;
</ins><span class="cx"> class Query;
</span><span class="cx"> class ResourceManager;
</span><span class="cx"> class Buffer;
</span><ins>+class VertexAttribute;
+class VertexArray;
+class Sampler;
+class TransformFeedback;
</ins><span class="cx">
</span><del>-enum QueryType
-{
- QUERY_ANY_SAMPLES_PASSED,
- QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE,
-
- QUERY_TYPE_COUNT
-};
-
-// Helper structure describing a single vertex attribute
-class VertexAttribute
-{
- public:
- VertexAttribute() : mType(GL_FLOAT), mSize(4), mNormalized(false), mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
- {
- mCurrentValue[0] = 0.0f;
- mCurrentValue[1] = 0.0f;
- mCurrentValue[2] = 0.0f;
- mCurrentValue[3] = 1.0f;
- }
-
- int typeSize() const
- {
- switch (mType)
- {
- case GL_BYTE: return mSize * sizeof(GLbyte);
- case GL_UNSIGNED_BYTE: return mSize * sizeof(GLubyte);
- case GL_SHORT: return mSize * sizeof(GLshort);
- case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
- case GL_FIXED: return mSize * sizeof(GLfixed);
- case GL_FLOAT: return mSize * sizeof(GLfloat);
- default: UNREACHABLE(); return mSize * sizeof(GLfloat);
- }
- }
-
- GLsizei stride() const
- {
- return mStride ? mStride : typeSize();
- }
-
- // From glVertexAttribPointer
- GLenum mType;
- GLint mSize;
- bool mNormalized;
- GLsizei mStride; // 0 means natural stride
-
- union
- {
- const void *mPointer;
- intptr_t mOffset;
- };
-
- BindingPointer<Buffer> mBoundBuffer; // Captured when glVertexAttribPointer is called.
-
- bool mArrayEnabled; // From glEnable/DisableVertexAttribArray
- float mCurrentValue[4]; // From glVertexAttrib
- unsigned int mDivisor;
-};
-
</del><span class="cx"> // Helper structure to store all raw state
</span><span class="cx"> struct State
</span><span class="cx"> {
</span><del>- Color colorClearValue;
</del><ins>+ ColorF colorClearValue;
</ins><span class="cx"> GLclampf depthClearValue;
</span><span class="cx"> int stencilClearValue;
</span><span class="cx">
</span><span class="lines">@@ -131,7 +81,7 @@
</span><span class="cx"> Rectangle scissor;
</span><span class="cx">
</span><span class="cx"> BlendState blend;
</span><del>- Color blendColor;
</del><ins>+ ColorF blendColor;
</ins><span class="cx"> bool sampleCoverage;
</span><span class="cx"> GLclampf sampleCoverageValue;
</span><span class="cx"> bool sampleCoverageInvert;
</span><span class="lines">@@ -151,27 +101,40 @@
</span><span class="cx">
</span><span class="cx"> unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0
</span><span class="cx"> BindingPointer<Buffer> arrayBuffer;
</span><del>- BindingPointer<Buffer> elementArrayBuffer;
</del><span class="cx"> GLuint readFramebuffer;
</span><span class="cx"> GLuint drawFramebuffer;
</span><span class="cx"> BindingPointer<Renderbuffer> renderbuffer;
</span><span class="cx"> GLuint currentProgram;
</span><span class="cx">
</span><del>- VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
</del><ins>+ VertexAttribCurrentValueData vertexAttribCurrentValues[MAX_VERTEX_ATTRIBS]; // From glVertexAttrib
+ unsigned int vertexArray;
+
</ins><span class="cx"> BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
</span><del>- BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
</del><ins>+ GLuint samplers[IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
</ins><span class="cx">
</span><del>- GLint unpackAlignment;
- GLint packAlignment;
- bool packReverseRowOrder;
</del><ins>+ typedef std::map< GLenum, BindingPointer<Query> > ActiveQueryMap;
+ ActiveQueryMap activeQueries;
+
+ BindingPointer<Buffer> genericUniformBuffer;
+ OffsetBindingPointer<Buffer> uniformBuffers[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
+
+ BindingPointer<TransformFeedback> transformFeedback;
+ BindingPointer<Buffer> genericTransformFeedbackBuffer;
+ OffsetBindingPointer<Buffer> transformFeedbackBuffers[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+
+ BindingPointer<Buffer> copyReadBuffer;
+ BindingPointer<Buffer> copyWriteBuffer;
+
+ PixelUnpackState unpack;
+ PixelPackState pack;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class Context
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
</del><ins>+ Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
</ins><span class="cx">
</span><del>- ~Context();
</del><ins>+ virtual ~Context();
</ins><span class="cx">
</span><span class="cx"> void makeCurrent(egl::Surface *surface);
</span><span class="cx">
</span><span class="lines">@@ -179,12 +142,18 @@
</span><span class="cx"> bool isContextLost();
</span><span class="cx">
</span><span class="cx"> // State manipulation
</span><ins>+ void setCap(GLenum cap, bool enabled);
+ bool getCap(GLenum cap);
+
</ins><span class="cx"> void setClearColor(float red, float green, float blue, float alpha);
</span><span class="cx">
</span><span class="cx"> void setClearDepth(float depth);
</span><span class="cx">
</span><span class="cx"> void setClearStencil(int stencil);
</span><span class="cx">
</span><ins>+ void setRasterizerDiscard(bool enabled);
+ bool isRasterizerDiscardEnabled() const;
+
</ins><span class="cx"> void setCullFace(bool enabled);
</span><span class="cx"> bool isCullFaceEnabled() const;
</span><span class="cx">
</span><span class="lines">@@ -243,6 +212,7 @@
</span><span class="cx"> void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
</span><span class="cx">
</span><span class="cx"> void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
</span><ins>+ void getScissorParams(GLint *x, GLint *y, GLsizei *width, GLsizei *height);
</ins><span class="cx">
</span><span class="cx"> void setColorMask(bool red, bool green, bool blue, bool alpha);
</span><span class="cx"> void setDepthMask(bool mask);
</span><span class="lines">@@ -252,22 +222,27 @@
</span><span class="cx"> GLuint getReadFramebufferHandle() const;
</span><span class="cx"> GLuint getDrawFramebufferHandle() const;
</span><span class="cx"> GLuint getRenderbufferHandle() const;
</span><ins>+ GLuint getVertexArrayHandle() const;
+ GLuint getSamplerHandle(GLuint textureUnit) const;
</ins><span class="cx">
</span><span class="cx"> GLuint getArrayBufferHandle() const;
</span><span class="cx">
</span><span class="cx"> GLuint getActiveQuery(GLenum target) const;
</span><span class="cx">
</span><span class="cx"> void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
</span><del>- const VertexAttribute &getVertexAttribState(unsigned int attribNum);
</del><ins>+ const VertexAttribute &getVertexAttribState(unsigned int attribNum) const;
+ const VertexAttribCurrentValueData &getVertexAttribCurrentValue(unsigned int attribNum) const;
</ins><span class="cx"> void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
</span><del>- bool normalized, GLsizei stride, const void *pointer);
</del><ins>+ bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
</ins><span class="cx"> const void *getVertexAttribPointer(unsigned int attribNum) const;
</span><span class="cx">
</span><span class="cx"> void setUnpackAlignment(GLint alignment);
</span><span class="cx"> GLint getUnpackAlignment() const;
</span><ins>+ const PixelUnpackState &getUnpackState() const;
</ins><span class="cx">
</span><span class="cx"> void setPackAlignment(GLint alignment);
</span><span class="cx"> GLint getPackAlignment() const;
</span><ins>+ const PixelPackState &getPackState() const;
</ins><span class="cx">
</span><span class="cx"> void setPackReverseRowOrder(bool reverseRowOrder);
</span><span class="cx"> bool getPackReverseRowOrder() const;
</span><span class="lines">@@ -279,35 +254,58 @@
</span><span class="cx"> GLuint createProgram();
</span><span class="cx"> GLuint createTexture();
</span><span class="cx"> GLuint createRenderbuffer();
</span><ins>+ GLuint createSampler();
+ GLuint createTransformFeedback();
+ GLsync createFenceSync(GLenum condition);
</ins><span class="cx">
</span><span class="cx"> void deleteBuffer(GLuint buffer);
</span><span class="cx"> void deleteShader(GLuint shader);
</span><span class="cx"> void deleteProgram(GLuint program);
</span><span class="cx"> void deleteTexture(GLuint texture);
</span><span class="cx"> void deleteRenderbuffer(GLuint renderbuffer);
</span><ins>+ void deleteSampler(GLuint sampler);
+ void deleteTransformFeedback(GLuint transformFeedback);
+ void deleteFenceSync(GLsync fenceSync);
</ins><span class="cx">
</span><span class="cx"> // Framebuffers are owned by the Context, so these methods do not pass through
</span><span class="cx"> GLuint createFramebuffer();
</span><span class="cx"> void deleteFramebuffer(GLuint framebuffer);
</span><span class="cx">
</span><del>- // Fences are owned by the Context.
- GLuint createFence();
- void deleteFence(GLuint fence);
</del><ins>+ // NV Fences are owned by the Context.
+ GLuint createFenceNV();
+ void deleteFenceNV(GLuint fence);
</ins><span class="cx">
</span><span class="cx"> // Queries are owned by the Context;
</span><span class="cx"> GLuint createQuery();
</span><span class="cx"> void deleteQuery(GLuint query);
</span><span class="cx">
</span><ins>+ // Vertex arrays are owned by the Context
+ GLuint createVertexArray();
+ void deleteVertexArray(GLuint vertexArray);
+
</ins><span class="cx"> void bindArrayBuffer(GLuint buffer);
</span><span class="cx"> void bindElementArrayBuffer(GLuint buffer);
</span><span class="cx"> void bindTexture2D(GLuint texture);
</span><span class="cx"> void bindTextureCubeMap(GLuint texture);
</span><ins>+ void bindTexture3D(GLuint texture);
+ void bindTexture2DArray(GLuint texture);
</ins><span class="cx"> void bindReadFramebuffer(GLuint framebuffer);
</span><span class="cx"> void bindDrawFramebuffer(GLuint framebuffer);
</span><span class="cx"> void bindRenderbuffer(GLuint renderbuffer);
</span><ins>+ 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);
</ins><span class="cx"> void useProgram(GLuint program);
</span><span class="cx"> void linkProgram(GLuint program);
</span><span class="cx"> void setProgramBinary(GLuint program, const void *binary, GLint length);
</span><ins>+ void bindTransformFeedback(GLuint transformFeedback);
</ins><span class="cx">
</span><span class="cx"> void beginQuery(GLenum target, GLuint query);
</span><span class="cx"> void endQuery(GLenum target);
</span><span class="lines">@@ -316,35 +314,75 @@
</span><span class="cx">
</span><span class="cx"> void setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
</span><span class="cx">
</span><del>- void setVertexAttrib(GLuint index, const GLfloat *values);
</del><ins>+ void setVertexAttribf(GLuint index, const GLfloat values[4]);
+ void setVertexAttribu(GLuint index, const GLuint values[4]);
+ void setVertexAttribi(GLuint index, const GLint values[4]);
</ins><span class="cx"> void setVertexAttribDivisor(GLuint index, GLuint divisor);
</span><span class="cx">
</span><ins>+ 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);
+
</ins><span class="cx"> Buffer *getBuffer(GLuint handle);
</span><del>- Fence *getFence(GLuint handle);
- Shader *getShader(GLuint handle);
- Program *getProgram(GLuint handle);
</del><ins>+ FenceNV *getFenceNV(GLuint handle);
+ FenceSync *getFenceSync(GLsync handle) const;
+ Shader *getShader(GLuint handle) const;
+ Program *getProgram(GLuint handle) const;
</ins><span class="cx"> Texture *getTexture(GLuint handle);
</span><del>- Framebuffer *getFramebuffer(GLuint handle);
</del><ins>+ Framebuffer *getFramebuffer(GLuint handle) const;
</ins><span class="cx"> Renderbuffer *getRenderbuffer(GLuint handle);
</span><ins>+ VertexArray *getVertexArray(GLuint handle) const;
+ Sampler *getSampler(GLuint handle) const;
</ins><span class="cx"> Query *getQuery(GLuint handle, bool create, GLenum type);
</span><ins>+ TransformFeedback *getTransformFeedback(GLuint handle) const;
</ins><span class="cx">
</span><ins>+ Buffer *getTargetBuffer(GLenum target) const;
</ins><span class="cx"> Buffer *getArrayBuffer();
</span><del>- Buffer *getElementArrayBuffer();
</del><ins>+ Buffer *getElementArrayBuffer() const;
</ins><span class="cx"> ProgramBinary *getCurrentProgramBinary();
</span><del>- Texture2D *getTexture2D();
- TextureCubeMap *getTextureCubeMap();
- Texture *getSamplerTexture(unsigned int sampler, TextureType type);
</del><ins>+
+ 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;
</ins><span class="cx"> Framebuffer *getReadFramebuffer();
</span><span class="cx"> Framebuffer *getDrawFramebuffer();
</span><ins>+ VertexArray *getCurrentVertexArray() const;
+ TransformFeedback *getCurrentTransformFeedback() const;
</ins><span class="cx">
</span><ins>+ bool isSampler(GLuint samplerName) const;
+
+ bool getBooleanv(GLenum pname, GLboolean *params);
</ins><span class="cx"> bool getFloatv(GLenum pname, GLfloat *params);
</span><span class="cx"> bool getIntegerv(GLenum pname, GLint *params);
</span><del>- bool getBooleanv(GLenum pname, GLboolean *params);
</del><ins>+ bool getInteger64v(GLenum pname, GLint64 *params);
</ins><span class="cx">
</span><ins>+ bool getIndexedIntegerv(GLenum target, GLuint index, GLint *data);
+ bool getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data);
+
</ins><span class="cx"> bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
</span><ins>+ bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
</ins><span class="cx">
</span><ins>+ 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);
+
</ins><span class="cx"> void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
</span><del>- void clear(GLbitfield mask);
</del><span class="cx"> void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
</span><span class="cx"> void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances);
</span><span class="cx"> void sync(bool block); // flush/finish
</span><span class="lines">@@ -359,16 +397,31 @@
</span><span class="cx"> GLenum getResetStatus();
</span><span class="cx"> virtual bool isResetNotificationEnabled();
</span><span class="cx">
</span><ins>+ virtual int getClientVersion() const;
+
</ins><span class="cx"> int getMajorShaderModel() const;
</span><span class="cx"> float getMaximumPointSize() const;
</span><span class="cx"> unsigned int getMaximumCombinedTextureImageUnits() const;
</span><ins>+ unsigned int getMaximumCombinedUniformBufferBindings() const;
</ins><span class="cx"> int getMaximumRenderbufferDimension() const;
</span><del>- int getMaximumTextureDimension() const;
</del><ins>+ int getMaximum2DTextureDimension() const;
</ins><span class="cx"> int getMaximumCubeTextureDimension() const;
</span><del>- int getMaximumTextureLevel() const;
</del><ins>+ int getMaximum3DTextureDimension() const;
+ int getMaximum2DArrayTextureLayers() const;
+ int getMaximum2DTextureLevel() const;
+ int getMaximumCubeTextureLevel() const;
+ int getMaximum3DTextureLevel() const;
+ int getMaximum2DArrayTextureLevel() const;
</ins><span class="cx"> unsigned int getMaximumRenderTargets() const;
</span><span class="cx"> GLsizei getMaxSupportedSamples() const;
</span><del>- const char *getExtensionString() const;
</del><ins>+ 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;
</ins><span class="cx"> const char *getRendererString() const;
</span><span class="cx"> bool supportsEventQueries() const;
</span><span class="cx"> bool supportsOcclusionQueries() const;
</span><span class="lines">@@ -384,20 +437,26 @@
</span><span class="cx"> bool supportsFloat16RenderableTextures() const;
</span><span class="cx"> bool supportsLuminanceTextures() const;
</span><span class="cx"> bool supportsLuminanceAlphaTextures() const;
</span><ins>+ bool supportsRGTextures() const;
</ins><span class="cx"> bool supportsDepthTextures() const;
</span><span class="cx"> bool supports32bitIndices() const;
</span><span class="cx"> bool supportsNonPower2Texture() const;
</span><span class="cx"> bool supportsInstancing() const;
</span><span class="cx"> bool supportsTextureFilterAnisotropy() const;
</span><ins>+ bool supportsPBOs() const;
</ins><span class="cx">
</span><del>- bool getCurrentReadFormatType(GLenum *format, GLenum *type);
</del><ins>+ bool getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type);
</ins><span class="cx">
</span><span class="cx"> float getTextureMaxAnisotropy() const;
</span><span class="cx">
</span><del>- void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask);
</del><ins>+ void blitFramebuffer(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><ins>+ void invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+ bool hasMappedBuffer(GLenum target) const;
+
</ins><span class="cx"> rx::Renderer *getRenderer() { return mRenderer; }
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -405,15 +464,25 @@
</span><span class="cx">
</span><span class="cx"> bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
</span><span class="cx"> void applyState(GLenum drawMode);
</span><del>- void applyShaders();
- void applyTextures();
- void applyTextures(SamplerType type);
</del><ins>+ void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
+ void applyTextures(ProgramBinary *programBinary);
+ void applyTextures(ProgramBinary *programBinary, SamplerType type);
+ bool applyUniformBuffers();
+ bool applyTransformFeedbackBuffers();
+ void markTransformFeedbackUsage();
</ins><span class="cx">
</span><span class="cx"> void detachBuffer(GLuint buffer);
</span><span class="cx"> void detachTexture(GLuint texture);
</span><span class="cx"> void detachFramebuffer(GLuint framebuffer);
</span><span class="cx"> void detachRenderbuffer(GLuint renderbuffer);
</span><ins>+ void detachVertexArray(GLuint vertexArray);
+ void detachTransformFeedback(GLuint transformFeedback);
+ void detachSampler(GLuint sampler);
</ins><span class="cx">
</span><ins>+ void generateSwizzles(ProgramBinary *programBinary);
+ void generateSwizzles(ProgramBinary *programBinary, SamplerType type);
+ bool getCurrentTextureAndSamplerState(ProgramBinary *programBinary, SamplerType type, int index, Texture **outTexture,
+ TextureType *outTextureType, SamplerState *outSampler);
</ins><span class="cx"> Texture *getIncompleteTexture(TextureType type);
</span><span class="cx">
</span><span class="cx"> bool skipDraw(GLenum drawMode);
</span><span class="lines">@@ -426,32 +495,38 @@
</span><span class="cx">
</span><span class="cx"> rx::Renderer *const mRenderer;
</span><span class="cx">
</span><ins>+ int mClientVersion;
+
</ins><span class="cx"> State mState;
</span><span class="cx">
</span><span class="cx"> BindingPointer<Texture2D> mTexture2DZero;
</span><span class="cx"> BindingPointer<TextureCubeMap> mTextureCubeMapZero;
</span><ins>+ BindingPointer<Texture3D> mTexture3DZero;
+ BindingPointer<Texture2DArray> mTexture2DArrayZero;
</ins><span class="cx">
</span><del>-#ifndef HASH_MAP
-# ifdef _MSC_VER
-# define HASH_MAP stdext::hash_map
-# else
-# define HASH_MAP std::unordered_map
-# endif
-#endif
-
- typedef HASH_MAP<GLuint, Framebuffer*> FramebufferMap;
</del><ins>+ typedef std::unordered_map<GLuint, Framebuffer*> FramebufferMap;
</ins><span class="cx"> FramebufferMap mFramebufferMap;
</span><span class="cx"> HandleAllocator mFramebufferHandleAllocator;
</span><span class="cx">
</span><del>- typedef HASH_MAP<GLuint, Fence*> FenceMap;
- FenceMap mFenceMap;
- HandleAllocator mFenceHandleAllocator;
</del><ins>+ typedef std::unordered_map<GLuint, FenceNV*> FenceNVMap;
+ FenceNVMap mFenceNVMap;
+ HandleAllocator mFenceNVHandleAllocator;
</ins><span class="cx">
</span><del>- typedef HASH_MAP<GLuint, Query*> QueryMap;
</del><ins>+ typedef std::unordered_map<GLuint, Query*> QueryMap;
</ins><span class="cx"> QueryMap mQueryMap;
</span><span class="cx"> HandleAllocator mQueryHandleAllocator;
</span><span class="cx">
</span><del>- const char *mExtensionString;
</del><ins>+ typedef std::unordered_map<GLuint, VertexArray*> VertexArrayMap;
+ VertexArrayMap mVertexArrayMap;
+ HandleAllocator mVertexArrayHandleAllocator;
+
+ BindingPointer<TransformFeedback> mTransformFeedbackZero;
+ typedef std::unordered_map<GLuint, TransformFeedback*> TransformFeedbackMap;
+ TransformFeedbackMap mTransformFeedbackMap;
+ HandleAllocator mTransformFeedbackAllocator;
+
+ std::vector<std::string> mExtensionStringList;
+ const char *mCombinedExtensionsString;
</ins><span class="cx"> const char *mRendererString;
</span><span class="cx">
</span><span class="cx"> BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
</span><span class="lines">@@ -480,9 +555,14 @@
</span><span class="cx"> bool mSupportsInstancing;
</span><span class="cx"> int mMaxViewportDimension;
</span><span class="cx"> int mMaxRenderbufferDimension;
</span><del>- int mMaxTextureDimension;
</del><ins>+ int mMax2DTextureDimension;
</ins><span class="cx"> int mMaxCubeTextureDimension;
</span><del>- int mMaxTextureLevel;
</del><ins>+ int mMax3DTextureDimension;
+ int mMax2DArrayTextureLayers;
+ int mMax2DTextureLevel;
+ int mMaxCubeTextureLevel;
+ int mMax3DTextureLevel;
+ int mMax2DArrayTextureLevel;
</ins><span class="cx"> float mMaxTextureAnisotropy;
</span><span class="cx"> bool mSupportsEventQueries;
</span><span class="cx"> bool mSupportsOcclusionQueries;
</span><span class="lines">@@ -498,9 +578,11 @@
</span><span class="cx"> bool mSupportsFloat16RenderableTextures;
</span><span class="cx"> bool mSupportsLuminanceTextures;
</span><span class="cx"> bool mSupportsLuminanceAlphaTextures;
</span><ins>+ bool mSupportsRGTextures;
</ins><span class="cx"> bool mSupportsDepthTextures;
</span><span class="cx"> bool mSupports32bitIndices;
</span><span class="cx"> bool mSupportsTextureFilterAnisotropy;
</span><ins>+ bool mSupportsPBOs;
</ins><span class="cx"> int mNumCompressedTextureFormats;
</span><span class="cx">
</span><span class="cx"> ResourceManager *mResourceManager;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2DynamicHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,1047 @@
</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 "precompiled.h"
+
+#include "libGLESv2/DynamicHLSL.h"
+#include "libGLESv2/Shader.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "common/utilities.h"
+#include "libGLESv2/ProgramBinary.h"
+#include "libGLESv2/formatutils.h"
+#include "common/blocklayout.h"
+
+static std::string Str(int i)
+{
+ char buffer[20];
+ snprintf(buffer, sizeof(buffer), "%d", i);
+ return buffer;
+}
+
+namespace gl_d3d
+{
+
+std::string HLSLComponentTypeString(GLenum componentType)
+{
+ switch (componentType)
+ {
+ case GL_UNSIGNED_INT: return "uint";
+ case GL_INT: return "int";
+ case GL_UNSIGNED_NORMALIZED:
+ case GL_SIGNED_NORMALIZED:
+ case GL_FLOAT: return "float";
+ default: UNREACHABLE(); return "not-component-type";
+ }
+}
+
+std::string HLSLComponentTypeString(GLenum componentType, int componentCount)
+{
+ return HLSLComponentTypeString(componentType) + (componentCount > 1 ? Str(componentCount) : "");
+}
+
+std::string HLSLMatrixTypeString(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT_MAT2: return "float2x2";
+ case GL_FLOAT_MAT3: return "float3x3";
+ case GL_FLOAT_MAT4: return "float4x4";
+ case GL_FLOAT_MAT2x3: return "float2x3";
+ case GL_FLOAT_MAT3x2: return "float3x2";
+ case GL_FLOAT_MAT2x4: return "float2x4";
+ case GL_FLOAT_MAT4x2: return "float4x2";
+ case GL_FLOAT_MAT3x4: return "float3x4";
+ case GL_FLOAT_MAT4x3: return "float4x3";
+ default: UNREACHABLE(); return "not-matrix-type";
+ }
+}
+
+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 ? "" : "[" + Str(i) + "]");
+}
+
+const std::string DynamicHLSL::VERTEX_ATTRIBUTE_STUB_STRING = "@@ VERTEX ATTRIBUTES @@";
+
+DynamicHLSL::DynamicHLSL(rx::Renderer *const renderer)
+ : mRenderer(renderer)
+{
+}
+
+static bool packVarying(Varying *varying, const int maxVaryingVectors, const ShaderVariable *packing[][4])
+{
+ GLenum transposedType = TransposeMatrixType(varying->type);
+
+ // matrices within varying structs are not transposed
+ int registers = (varying->isStruct() ? HLSLVariableRegisterCount(*varying) : VariableRowCount(transposedType)) * varying->elementCount();
+ int elements = (varying->isStruct() ? 4 : VariableColumnCount(transposedType));
+ bool success = false;
+
+ if (elements == 2 || elements == 3 || elements == 4)
+ {
+ for (int r = 0; r <= maxVaryingVectors - registers && !success; r++)
+ {
+ bool available = true;
+
+ for (int y = 0; y < registers && available; y++)
+ {
+ for (int x = 0; x < elements && available; x++)
+ {
+ if (packing[r + y][x])
+ {
+ available = false;
+ }
+ }
+ }
+
+ if (available)
+ {
+ varying->registerIndex = r;
+ varying->elementIndex = 0;
+
+ for (int y = 0; y < registers; y++)
+ {
+ for (int x = 0; x < elements; x++)
+ {
+ packing[r + y][x] = &*varying;
+ }
+ }
+
+ success = true;
+ }
+ }
+
+ if (!success && elements == 2)
+ {
+ for (int r = maxVaryingVectors - registers; r >= 0 && !success; r--)
+ {
+ bool available = true;
+
+ for (int y = 0; y < registers && available; y++)
+ {
+ for (int x = 2; x < 4 && available; x++)
+ {
+ if (packing[r + y][x])
+ {
+ available = false;
+ }
+ }
+ }
+
+ if (available)
+ {
+ varying->registerIndex = r;
+ varying->elementIndex = 2;
+
+ for (int y = 0; y < registers; y++)
+ {
+ for (int x = 2; x < 4; x++)
+ {
+ packing[r + y][x] = &*varying;
+ }
+ }
+
+ success = true;
+ }
+ }
+ }
+ }
+ else if (elements == 1)
+ {
+ int space[4] = { 0 };
+
+ for (int y = 0; y < maxVaryingVectors; y++)
+ {
+ for (int x = 0; x < 4; x++)
+ {
+ space[x] += packing[y][x] ? 0 : 1;
+ }
+ }
+
+ int column = 0;
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (space[x] >= registers && space[x] < space[column])
+ {
+ column = x;
+ }
+ }
+
+ if (space[column] >= registers)
+ {
+ for (int r = 0; r < maxVaryingVectors; r++)
+ {
+ if (!packing[r][column])
+ {
+ varying->registerIndex = r;
+
+ for (int y = r; y < r + registers; y++)
+ {
+ packing[y][column] = &*varying;
+ }
+
+ break;
+ }
+ }
+
+ varying->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 &infoLog, const ShaderVariable *packing[][4], FragmentShader *fragmentShader,
+ VertexShader *vertexShader, const std::vector<std::string>& transformFeedbackVaryings)
+{
+ const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
+
+ vertexShader->resetVaryingsRegisterAssignment();
+ fragmentShader->resetVaryingsRegisterAssignment();
+
+ std::set<std::string> packedVaryings;
+
+ for (unsigned int varyingIndex = 0; varyingIndex < fragmentShader->mVaryings.size(); varyingIndex++)
+ {
+ Varying *varying = &fragmentShader->mVaryings[varyingIndex];
+ if (packVarying(varying, maxVaryingVectors, packing))
+ {
+ packedVaryings.insert(varying->name);
+ }
+ else
+ {
+ infoLog.append("Could not pack varying %s", varying->name.c_str());
+ return -1;
+ }
+ }
+
+ for (unsigned int feedbackVaryingIndex = 0; feedbackVaryingIndex < transformFeedbackVaryings.size(); feedbackVaryingIndex++)
+ {
+ const std::string &transformFeedbackVarying = transformFeedbackVaryings[feedbackVaryingIndex];
+ if (packedVaryings.find(transformFeedbackVarying) == packedVaryings.end())
+ {
+ bool found = false;
+ for (unsigned int varyingIndex = 0; varyingIndex < vertexShader->mVaryings.size(); varyingIndex++)
+ {
+ Varying *varying = &vertexShader->mVaryings[varyingIndex];
+ if (transformFeedbackVarying == varying->name)
+ {
+ if (!packVarying(varying, maxVaryingVectors, packing))
+ {
+ infoLog.append("Could not pack varying %s", varying->name.c_str());
+ return -1;
+ }
+
+ found = true;
+ break;
+ }
+ }
+
+ if (!found && transformFeedbackVarying != "gl_Position" && transformFeedbackVarying != "gl_PointSize")
+ {
+ infoLog.append("Transform feedback varying %s does not exist in the vertex shader.", transformFeedbackVarying.c_str());
+ return -1;
+ }
+ }
+ }
+
+ // Return the number of used registers
+ int registers = 0;
+
+ for (int r = 0; r < maxVaryingVectors; r++)
+ {
+ if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
+ {
+ registers++;
+ }
+ }
+
+ return registers;
+}
+
+std::string DynamicHLSL::generateVaryingHLSL(VertexShader *shader, const std::string &varyingSemantic,
+ std::vector<LinkedVarying> *linkedVaryings) const
+{
+ std::string varyingHLSL;
+
+ for (unsigned int varyingIndex = 0; varyingIndex < shader->mVaryings.size(); varyingIndex++)
+ {
+ Varying *varying = &shader->mVaryings[varyingIndex];
+ if (varying->registerAssigned())
+ {
+ GLenum transposedType = TransposeMatrixType(varying->type);
+ int variableRows = (varying->isStruct() ? 1 : VariableRowCount(transposedType));
+
+ for (unsigned int elementIndex = 0; elementIndex < varying->elementCount(); elementIndex++)
+ {
+ for (int row = 0; row < variableRows; row++)
+ {
+ switch (varying->interpolation)
+ {
+ case INTERPOLATION_SMOOTH: varyingHLSL += " "; break;
+ case INTERPOLATION_FLAT: varyingHLSL += " nointerpolation "; break;
+ case INTERPOLATION_CENTROID: varyingHLSL += " centroid "; break;
+ default: UNREACHABLE();
+ }
+
+ unsigned int semanticIndex = elementIndex * variableRows + varying->registerIndex + row;
+ std::string n = Str(semanticIndex);
+
+ std::string typeString;
+
+ if (varying->isStruct())
+ {
+ // matrices within structs are not transposed, so
+ // do not use the special struct prefix "rm"
+ typeString = decorateVariable(varying->structName);
+ }
+ else
+ {
+ GLenum componentType = UniformComponentType(transposedType);
+ int columnCount = VariableColumnCount(transposedType);
+ typeString = gl_d3d::HLSLComponentTypeString(componentType, columnCount);
+ }
+ varyingHLSL += typeString + " v" + n + " : " + varyingSemantic + n + ";\n";
+ }
+ }
+
+ if (linkedVaryings)
+ {
+ linkedVaryings->push_back(LinkedVarying(varying->name, varying->type, varying->elementCount(),
+ varyingSemantic, varying->registerIndex,
+ variableRows * varying->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 < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ ASSERT(inputIndex < MAX_VERTEX_ATTRIBS);
+
+ const VertexFormat &vertexFormat = inputLayout[inputIndex];
+ const Attribute &shaderAttribute = shaderAttributes[attributeIndex];
+
+ if (!shaderAttribute.name.empty())
+ {
+ // HLSL code for input structure
+ if (IsMatrixType(shaderAttribute.type))
+ {
+ // Matrix types are always transposed
+ structHLSL += " " + gl_d3d::HLSLMatrixTypeString(TransposeMatrixType(shaderAttribute.type));
+ }
+ else
+ {
+ GLenum componentType = mRenderer->getVertexComponentType(vertexFormat);
+ structHLSL += " " + gl_d3d::HLSLComponentTypeString(componentType, UniformComponentCount(shaderAttribute.type));
+ }
+
+ structHLSL += " " + decorateVariable(shaderAttribute.name) + " : TEXCOORD" + Str(semanticIndex) + ";\n";
+ semanticIndex += AttributeRegisterCount(shaderAttribute.type);
+
+ // HLSL code for initialization
+ initHLSL += " " + decorateVariable(shaderAttribute.name) + " = ";
+
+ // Mismatched vertex attribute to vertex input may result in an undefined
+ // data reinterpretation (eg for pure integer->float, float->pure integer)
+ // TODO: issue warning with gl debug info extension, when supported
+ if (IsMatrixType(shaderAttribute.type) ||
+ (mRenderer->getVertexConversionType(vertexFormat) & rx::VERTEX_CONVERT_GPU) != 0)
+ {
+ initHLSL += generateAttributeConversionHLSL(vertexFormat, shaderAttribute);
+ }
+ else
+ {
+ initHLSL += "input." + decorateVariable(shaderAttribute.name);
+ }
+
+ initHLSL += ";\n";
+
+ inputIndex += VariableRowCount(TransposeMatrixType(shaderAttribute.type));
+ }
+ }
+
+ return "struct VS_INPUT\n"
+ "{\n" +
+ structHLSL +
+ "};\n"
+ "\n"
+ "void initAttributes(VS_INPUT input)\n"
+ "{\n" +
+ initHLSL +
+ "}\n";
+}
+
+bool DynamicHLSL::generateShaderLinkHLSL(InfoLog &infoLog, int registers, const ShaderVariable *packing[][4],
+ std::string& pixelHLSL, std::string& vertexHLSL,
+ FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings,
+ std::vector<LinkedVarying> *linkedVaryings,
+ std::map<int, VariableLocation> *programOutputVars) const
+{
+ if (pixelHLSL.empty() || vertexHLSL.empty())
+ {
+ return false;
+ }
+
+ bool usesMRT = fragmentShader->mUsesMultipleRenderTargets;
+ bool usesFragColor = fragmentShader->mUsesFragColor;
+ bool usesFragData = fragmentShader->mUsesFragData;
+ if (usesFragColor && usesFragData)
+ {
+ infoLog.append("Cannot use both gl_FragColor and gl_FragData in the same fragment shader.");
+ return false;
+ }
+
+ // Write the HLSL input/output declarations
+ const int shaderModel = mRenderer->getMajorShaderModel();
+ const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
+
+ const int registersNeeded = registers + (fragmentShader->mUsesFragCoord ? 1 : 0) + (fragmentShader->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->mUsesFragColor && mRenderer->getCurrentClientVersion() < 3);
+ const unsigned int numRenderTargets = (broadcast || usesMRT ? mRenderer->getMaxRenderTargets() : 1);
+
+ int shaderVersion = vertexShader->getShaderVersion();
+
+ if (registersNeeded > maxVaryingVectors)
+ {
+ infoLog.append("No varying registers left to support gl_FragCoord/gl_PointCoord");
+
+ return false;
+ }
+
+ std::string varyingSemantic = (vertexShader->mUsesPointSize && shaderModel == 3) ? "COLOR" : "TEXCOORD";
+ std::string targetSemantic = (shaderModel >= 4) ? "SV_Target" : "COLOR";
+ std::string dxPositionSemantic = (shaderModel >= 4) ? "SV_Position" : "POSITION";
+ std::string depthSemantic = (shaderModel >= 4) ? "SV_Depth" : "DEPTH";
+
+ 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->mUsesFragCoord)
+ {
+ fragCoordSemanticIndex = reservedRegisterIndex++;
+ fragCoordSemantic = varyingSemantic;
+ }
+
+ std::string pointCoordSemantic;
+ unsigned int pointCoordSemanticIndex = 0;
+ if (fragmentShader->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 = "TEXCOORD0";
+ }
+ else if (shaderModel >= 4)
+ {
+ pointCoordSemanticIndex = reservedRegisterIndex++;
+ pointCoordSemantic = varyingSemantic;
+ }
+ }
+
+ // Add stub string to be replaced when shader is dynamically defined by its layout
+ vertexHLSL += "\n" + VERTEX_ATTRIBUTE_STUB_STRING + "\n";
+
+ vertexHLSL += "struct VS_OUTPUT\n"
+ "{\n";
+
+ if (shaderModel < 4)
+ {
+ vertexHLSL += " float4 _dx_Position : " + dxPositionSemantic + ";\n";
+ vertexHLSL += " float4 gl_Position : " + glPositionSemantic + Str(glPositionSemanticIndex) + ";\n";
+ linkedVaryings->push_back(LinkedVarying("gl_Position", GL_FLOAT_VEC4, 1, glPositionSemantic, glPositionSemanticIndex, 1));
+
+ }
+
+ vertexHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ vertexHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + Str(fragCoordSemanticIndex) + ";\n";
+ linkedVaryings->push_back(LinkedVarying("gl_FragCoord", GL_FLOAT_VEC4, 1, fragCoordSemantic, fragCoordSemanticIndex, 1));
+ }
+
+ if (vertexShader->mUsesPointSize && shaderModel >= 3)
+ {
+ vertexHLSL += " float gl_PointSize : PSIZE;\n";
+ linkedVaryings->push_back(LinkedVarying("gl_PointSize", GL_FLOAT, 1, "PSIZE", 0, 1));
+ }
+
+ if (shaderModel >= 4)
+ {
+ vertexHLSL += " float4 _dx_Position : " + dxPositionSemantic + ";\n";
+ vertexHLSL += " float4 gl_Position : " + glPositionSemantic + Str(glPositionSemanticIndex) + ";\n";
+ linkedVaryings->push_back(LinkedVarying("gl_Position", GL_FLOAT_VEC4, 1, glPositionSemantic, glPositionSemanticIndex, 1));
+ }
+
+ vertexHLSL += "};\n"
+ "\n"
+ "VS_OUTPUT main(VS_INPUT input)\n"
+ "{\n"
+ " initAttributes(input);\n";
+
+ if (shaderModel >= 4)
+ {
+ vertexHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " VS_OUTPUT output;\n"
+ " output.gl_Position = gl_Position;\n"
+ " output._dx_Position.x = gl_Position.x;\n"
+ " output._dx_Position.y = -gl_Position.y;\n"
+ " output._dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
+ " output._dx_Position.w = gl_Position.w;\n";
+ }
+ else
+ {
+ vertexHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " VS_OUTPUT output;\n"
+ " output.gl_Position = gl_Position;\n"
+ " output._dx_Position.x = gl_Position.x * dx_ViewAdjust.z + dx_ViewAdjust.x * gl_Position.w;\n"
+ " output._dx_Position.y = -(gl_Position.y * dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n"
+ " output._dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
+ " output._dx_Position.w = gl_Position.w;\n";
+ }
+
+ if (vertexShader->mUsesPointSize && shaderModel >= 3)
+ {
+ vertexHLSL += " output.gl_PointSize = gl_PointSize;\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ vertexHLSL += " output.gl_FragCoord = gl_Position;\n";
+ }
+
+ for (unsigned int vertVaryingIndex = 0; vertVaryingIndex < vertexShader->mVaryings.size(); vertVaryingIndex++)
+ {
+ Varying *varying = &vertexShader->mVaryings[vertVaryingIndex];
+ if (varying->registerAssigned())
+ {
+ for (unsigned int elementIndex = 0; elementIndex < varying->elementCount(); elementIndex++)
+ {
+ int variableRows = (varying->isStruct() ? 1 : VariableRowCount(TransposeMatrixType(varying->type)));
+
+ for (int row = 0; row < variableRows; row++)
+ {
+ int r = varying->registerIndex + elementIndex * variableRows + row;
+ vertexHLSL += " output.v" + Str(r);
+
+ bool sharedRegister = false; // Register used by multiple varyings
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (packing[r][x] && packing[r][x] != packing[r][0])
+ {
+ sharedRegister = true;
+ break;
+ }
+ }
+
+ if(sharedRegister)
+ {
+ vertexHLSL += ".";
+
+ for (int x = 0; x < 4; x++)
+ {
+ if (packing[r][x] == &*varying)
+ {
+ switch(x)
+ {
+ case 0: vertexHLSL += "x"; break;
+ case 1: vertexHLSL += "y"; break;
+ case 2: vertexHLSL += "z"; break;
+ case 3: vertexHLSL += "w"; break;
+ }
+ }
+ }
+ }
+
+ vertexHLSL += " = _" + varying->name;
+
+ if (varying->isArray())
+ {
+ vertexHLSL += ArrayString(elementIndex);
+ }
+
+ if (variableRows > 1)
+ {
+ vertexHLSL += ArrayString(row);
+ }
+
+ vertexHLSL += ";\n";
+ }
+ }
+ }
+ }
+
+ vertexHLSL += "\n"
+ " return output;\n"
+ "}\n";
+
+ pixelHLSL += "struct PS_INPUT\n"
+ "{\n";
+
+ pixelHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ pixelHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + Str(fragCoordSemanticIndex) + ";\n";
+ }
+
+ if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
+ {
+ pixelHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + Str(pointCoordSemanticIndex) + ";\n";
+ }
+
+ // 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->mUsesPointSize && shaderModel >= 4)
+ {
+ pixelHLSL += " float gl_PointSize : PSIZE;\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ if (shaderModel >= 4)
+ {
+ pixelHLSL += " float4 dx_VPos : SV_Position;\n";
+ }
+ else if (shaderModel >= 3)
+ {
+ pixelHLSL += " float2 dx_VPos : VPOS;\n";
+ }
+ }
+
+ pixelHLSL += "};\n"
+ "\n"
+ "struct PS_OUTPUT\n"
+ "{\n";
+
+ if (shaderVersion < 300)
+ {
+ for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
+ {
+ pixelHLSL += " float4 gl_Color" + Str(renderTargetIndex) + " : " + targetSemantic + Str(renderTargetIndex) + ";\n";
+ }
+
+ if (fragmentShader->mUsesFragDepth)
+ {
+ pixelHLSL += " float gl_Depth : " + depthSemantic + ";\n";
+ }
+ }
+ else
+ {
+ defineOutputVariables(fragmentShader, programOutputVars);
+
+ const std::vector<Attribute> &shaderOutputVars = fragmentShader->getOutputVariables();
+ for (auto locationIt = programOutputVars->begin(); locationIt != programOutputVars->end(); locationIt++)
+ {
+ const VariableLocation &outputLocation = locationIt->second;
+ const ShaderVariable &outputVariable = shaderOutputVars[outputLocation.index];
+ const std::string &elementString = (outputLocation.element == GL_INVALID_INDEX ? "" : Str(outputLocation.element));
+
+ pixelHLSL += " " + gl_d3d::HLSLTypeString(outputVariable.type) +
+ " out_" + outputLocation.name + elementString +
+ " : " + targetSemantic + Str(locationIt->first) + ";\n";
+ }
+ }
+
+ pixelHLSL += "};\n"
+ "\n";
+
+ if (fragmentShader->mUsesFrontFacing)
+ {
+ if (shaderModel >= 4)
+ {
+ pixelHLSL += "PS_OUTPUT main(PS_INPUT input, bool isFrontFace : SV_IsFrontFace)\n"
+ "{\n";
+ }
+ else
+ {
+ pixelHLSL += "PS_OUTPUT main(PS_INPUT input, float vFace : VFACE)\n"
+ "{\n";
+ }
+ }
+ else
+ {
+ pixelHLSL += "PS_OUTPUT main(PS_INPUT input)\n"
+ "{\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ pixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
+
+ if (shaderModel >= 4)
+ {
+ pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x;\n"
+ " gl_FragCoord.y = input.dx_VPos.y;\n";
+ }
+ else if (shaderModel >= 3)
+ {
+ pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
+ " gl_FragCoord.y = input.dx_VPos.y + 0.5;\n";
+ }
+ else
+ {
+ // dx_ViewCoords contains the viewport width/2, height/2, center.x and center.y. See Renderer::setViewport()
+ pixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_ViewCoords.x + dx_ViewCoords.z;\n"
+ " gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_ViewCoords.y + dx_ViewCoords.w;\n";
+ }
+
+ pixelHLSL += " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_DepthFront.x + dx_DepthFront.y;\n"
+ " gl_FragCoord.w = rhw;\n";
+ }
+
+ if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
+ {
+ pixelHLSL += " gl_PointCoord.x = input.gl_PointCoord.x;\n";
+ pixelHLSL += " gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n";
+ }
+
+ if (fragmentShader->mUsesFrontFacing)
+ {
+ if (shaderModel <= 3)
+ {
+ pixelHLSL += " gl_FrontFacing = (vFace * dx_DepthFront.z >= 0.0);\n";
+ }
+ else
+ {
+ pixelHLSL += " gl_FrontFacing = isFrontFace;\n";
+ }
+ }
+
+ for (unsigned int varyingIndex = 0; varyingIndex < fragmentShader->mVaryings.size(); varyingIndex++)
+ {
+ Varying *varying = &fragmentShader->mVaryings[varyingIndex];
+ if (varying->registerAssigned())
+ {
+ for (unsigned int elementIndex = 0; elementIndex < varying->elementCount(); elementIndex++)
+ {
+ GLenum transposedType = TransposeMatrixType(varying->type);
+ int variableRows = (varying->isStruct() ? 1 : VariableRowCount(transposedType));
+ for (int row = 0; row < variableRows; row++)
+ {
+ std::string n = Str(varying->registerIndex + elementIndex * variableRows + row);
+ pixelHLSL += " _" + varying->name;
+
+ if (varying->isArray())
+ {
+ pixelHLSL += ArrayString(elementIndex);
+ }
+
+ if (variableRows > 1)
+ {
+ pixelHLSL += ArrayString(row);
+ }
+
+ if (varying->isStruct())
+ {
+ pixelHLSL += " = input.v" + n + ";\n"; break;
+ }
+ else
+ {
+ switch (VariableColumnCount(transposedType))
+ {
+ case 1: pixelHLSL += " = input.v" + n + ".x;\n"; break;
+ case 2: pixelHLSL += " = input.v" + n + ".xy;\n"; break;
+ case 3: pixelHLSL += " = input.v" + n + ".xyz;\n"; break;
+ case 4: pixelHLSL += " = input.v" + n + ";\n"; break;
+ default: UNREACHABLE();
+ }
+ }
+ }
+ }
+ }
+ else UNREACHABLE();
+ }
+
+ pixelHLSL += "\n"
+ " gl_main();\n"
+ "\n"
+ " PS_OUTPUT output;\n";
+
+ if (shaderVersion < 300)
+ {
+ for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
+ {
+ unsigned int sourceColorIndex = broadcast ? 0 : renderTargetIndex;
+
+ pixelHLSL += " output.gl_Color" + Str(renderTargetIndex) + " = gl_Color[" + Str(sourceColorIndex) + "];\n";
+ }
+
+ if (fragmentShader->mUsesFragDepth)
+ {
+ pixelHLSL += " output.gl_Depth = gl_Depth;\n";
+ }
+ }
+ else
+ {
+ for (auto locationIt = programOutputVars->begin(); locationIt != programOutputVars->end(); locationIt++)
+ {
+ const VariableLocation &outputLocation = locationIt->second;
+ const std::string &variableName = "out_" + outputLocation.name;
+ const std::string &outVariableName = variableName + (outputLocation.element == GL_INVALID_INDEX ? "" : Str(outputLocation.element));
+ const std::string &staticVariableName = variableName + ArrayString(outputLocation.element);
+
+ pixelHLSL += " output." + outVariableName + " = " + staticVariableName + ";\n";
+ }
+ }
+
+ pixelHLSL += "\n"
+ " return output;\n"
+ "}\n";
+
+ return true;
+}
+
+void DynamicHLSL::defineOutputVariables(FragmentShader *fragmentShader, std::map<int, VariableLocation> *programOutputVars) const
+{
+ const std::vector<Attribute> &shaderOutputVars = fragmentShader->getOutputVariables();
+
+ for (unsigned int outputVariableIndex = 0; outputVariableIndex < shaderOutputVars.size(); outputVariableIndex++)
+ {
+ const Attribute &outputVariable = shaderOutputVars[outputVariableIndex];
+ const int baseLocation = outputVariable.location == -1 ? 0 : outputVariable.location;
+
+ if (outputVariable.arraySize > 0)
+ {
+ for (unsigned int elementIndex = 0; elementIndex < outputVariable.arraySize; elementIndex++)
+ {
+ const int location = baseLocation + elementIndex;
+ ASSERT(programOutputVars->count(location) == 0);
+ (*programOutputVars)[location] = VariableLocation(outputVariable.name, elementIndex, outputVariableIndex);
+ }
+ }
+ else
+ {
+ ASSERT(programOutputVars->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->mUsesPointSize && mRenderer->getMajorShaderModel() >= 4);
+ return generatePointSpriteHLSL(registers, packing, fragmentShader, vertexShader);
+}
+
+std::string DynamicHLSL::generatePointSpriteHLSL(int registers, const ShaderVariable *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const
+{
+ ASSERT(registers >= 0);
+ ASSERT(vertexShader->mUsesPointSize);
+ ASSERT(mRenderer->getMajorShaderModel() >= 4);
+
+ std::string geomHLSL;
+
+ std::string varyingSemantic = "TEXCOORD";
+
+ std::string fragCoordSemantic;
+ std::string pointCoordSemantic;
+
+ int reservedRegisterIndex = registers;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ fragCoordSemantic = varyingSemantic + Str(reservedRegisterIndex++);
+ }
+
+ if (fragmentShader->mUsesPointCoord)
+ {
+ pointCoordSemantic = varyingSemantic + Str(reservedRegisterIndex++);
+ }
+
+ geomHLSL += "uniform float4 dx_ViewCoords : register(c1);\n"
+ "\n"
+ "struct GS_INPUT\n"
+ "{\n";
+
+ std::string varyingHLSL = generateVaryingHLSL(vertexShader, varyingSemantic, NULL);
+
+ geomHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
+ }
+
+ geomHLSL += " float gl_PointSize : PSIZE;\n"
+ " float4 gl_Position : SV_Position;\n"
+ "};\n"
+ "\n"
+ "struct GS_OUTPUT\n"
+ "{\n";
+
+ geomHLSL += varyingHLSL;
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
+ }
+
+ if (fragmentShader->mUsesPointCoord)
+ {
+ geomHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + ";\n";
+ }
+
+ geomHLSL += " float gl_PointSize : PSIZE;\n"
+ " float4 gl_Position : SV_Position;\n"
+ "};\n"
+ "\n"
+ "static float2 pointSpriteCorners[] = \n"
+ "{\n"
+ " float2( 0.5f, -0.5f),\n"
+ " float2( 0.5f, 0.5f),\n"
+ " float2(-0.5f, -0.5f),\n"
+ " float2(-0.5f, 0.5f)\n"
+ "};\n"
+ "\n"
+ "static float2 pointSpriteTexcoords[] = \n"
+ "{\n"
+ " float2(1.0f, 1.0f),\n"
+ " float2(1.0f, 0.0f),\n"
+ " float2(0.0f, 1.0f),\n"
+ " float2(0.0f, 0.0f)\n"
+ "};\n"
+ "\n"
+ "static float minPointSize = " + Str(ALIASED_POINT_SIZE_RANGE_MIN) + ".0f;\n"
+ "static float maxPointSize = " + Str(mRenderer->getMaxPointSize()) + ".0f;\n"
+ "\n"
+ "[maxvertexcount(4)]\n"
+ "void main(point GS_INPUT input[1], inout TriangleStream<GS_OUTPUT> outStream)\n"
+ "{\n"
+ " GS_OUTPUT output = (GS_OUTPUT)0;\n"
+ " output.gl_PointSize = input[0].gl_PointSize;\n";
+
+ for (int r = 0; r < registers; r++)
+ {
+ geomHLSL += " output.v" + Str(r) + " = input[0].v" + Str(r) + ";\n";
+ }
+
+ if (fragmentShader->mUsesFragCoord)
+ {
+ geomHLSL += " output.gl_FragCoord = input[0].gl_FragCoord;\n";
+ }
+
+ geomHLSL += " \n"
+ " float gl_PointSize = clamp(input[0].gl_PointSize, minPointSize, maxPointSize);\n"
+ " float4 gl_Position = input[0].gl_Position;\n"
+ " float2 viewportScale = float2(1.0f / dx_ViewCoords.x, 1.0f / dx_ViewCoords.y) * gl_Position.w;\n";
+
+ for (int corner = 0; corner < 4; corner++)
+ {
+ geomHLSL += " \n"
+ " output.gl_Position = gl_Position + float4(pointSpriteCorners[" + Str(corner) + "] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n";
+
+ if (fragmentShader->mUsesPointCoord)
+ {
+ geomHLSL += " output.gl_PointCoord = pointSpriteTexcoords[" + Str(corner) + "];\n";
+ }
+
+ geomHLSL += " outStream.Append(output);\n";
+ }
+
+ geomHLSL += " \n"
+ " outStream.RestartStrip();\n"
+ "}\n";
+
+ return geomHLSL;
+}
+
+// This method needs to match OutputHLSL::decorate
+std::string DynamicHLSL::decorateVariable(const std::string &name)
+{
+ if (name.compare(0, 3, "gl_") != 0 && name.compare(0, 3, "dx_") != 0)
+ {
+ return "_" + name;
+ }
+
+ return name;
+}
+
+std::string DynamicHLSL::generateAttributeConversionHLSL(const VertexFormat &vertexFormat, const ShaderVariable &shaderAttrib) const
+{
+ std::string attribString = "input." + decorateVariable(shaderAttrib.name);
+
+ // Matrix
+ if (IsMatrixType(shaderAttrib.type))
+ {
+ return "transpose(" + attribString + ")";
+ }
+
+ GLenum shaderComponentType = UniformComponentType(shaderAttrib.type);
+ int shaderComponentCount = UniformComponentCount(shaderAttrib.type);
+
+ std::string padString = "";
+
+ // Perform integer to float conversion (if necessary)
+ bool requiresTypeConversion = (shaderComponentType == GL_FLOAT && vertexFormat.mType != GL_FLOAT);
+
+ // TODO: normalization for 32-bit integer formats
+ ASSERT(!requiresTypeConversion || !vertexFormat.mNormalized);
+
+ if (requiresTypeConversion || !padString.empty())
+ {
+ return "float" + Str(shaderComponentCount) + "(" + attribString + padString + ")";
+ }
+
+ // No conversion necessary
+ return attribString;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2DynamicHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,72 @@
</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 LIBGLESV2_DYNAMIC_HLSL_H_
+#define LIBGLESV2_DYNAMIC_HLSL_H_
+
+#include "common/angleutils.h"
+
+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 &infoLog, const ShaderVariable *packing[][4], FragmentShader *fragmentShader,
+ VertexShader *vertexShader, const std::vector<std::string>& transformFeedbackVaryings);
+ std::string generateInputLayoutHLSL(const VertexFormat inputLayout[], const Attribute shaderAttributes[]) const;
+ bool generateShaderLinkHLSL(InfoLog &infoLog, int registers, const ShaderVariable *packing[][4],
+ std::string& pixelHLSL, std::string& vertexHLSL,
+ FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings,
+ std::vector<LinkedVarying> *linkedVaryings,
+ std::map<int, VariableLocation> *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 &varyingSemantic,
+ std::vector<LinkedVarying> *linkedVaryings) const;
+ void defineOutputVariables(FragmentShader *fragmentShader, std::map<int, VariableLocation> *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 &name);
+
+ std::string generateAttributeConversionHLSL(const VertexFormat &vertexFormat, const ShaderVariable &shaderAttrib) const;
+};
+
+// Utility method shared between ProgramBinary and DynamicHLSL
+std::string ArrayString(unsigned int i);
+
+}
+
+#endif // LIBGLESV2_DYNAMIC_HLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Fencecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,46 +7,184 @@
</span><span class="cx">
</span><span class="cx"> // Fence.cpp: Implements the gl::Fence class, which supports the GL_NV_fence extension.
</span><span class="cx">
</span><ins>+// 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 "jumping" during certain hardware events.
+//
+// See the comments at the top of the Chromium source file "chromium/src/base/time/time_win.cc"
+// 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.
+
</ins><span class="cx"> #include "libGLESv2/Fence.h"
</span><span class="cx"> #include "libGLESv2/renderer/FenceImpl.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><ins>+#include "libGLESv2/main.h"
</ins><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx">
</span><del>-Fence::Fence(rx::Renderer *renderer)
</del><ins>+FenceNV::FenceNV(rx::Renderer *renderer)
</ins><span class="cx"> {
</span><span class="cx"> mFence = renderer->createFence();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Fence::~Fence()
</del><ins>+FenceNV::~FenceNV()
</ins><span class="cx"> {
</span><span class="cx"> delete mFence;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GLboolean Fence::isFence()
</del><ins>+GLboolean FenceNV::isFence() const
</ins><span class="cx"> {
</span><del>- return mFence->isFence();
</del><ins>+ // 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->isSet() ? GL_TRUE : GL_FALSE);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence::setFence(GLenum condition)
</del><ins>+void FenceNV::setFence(GLenum condition)
</ins><span class="cx"> {
</span><del>- mFence->setFence(condition);
</del><ins>+ mFence->set();
+
+ mCondition = condition;
+ mStatus = GL_FALSE;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-GLboolean Fence::testFence()
</del><ins>+GLboolean FenceNV::testFence()
</ins><span class="cx"> {
</span><del>- return mFence->testFence();
</del><ins>+ // Flush the command buffer by default
+ bool result = mFence->test(true);
+
+ mStatus = (result ? GL_TRUE : GL_FALSE);
+ return mStatus;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence::finishFence()
</del><ins>+void FenceNV::finishFence()
</ins><span class="cx"> {
</span><del>- mFence->finishFence();
</del><ins>+ ASSERT(mFence->isSet());
+
+ while (!mFence->test(true))
+ {
+ Sleep(0);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence::getFenceiv(GLenum pname, GLint *params)
</del><ins>+GLint FenceNV::getFencei(GLenum pname)
</ins><span class="cx"> {
</span><del>- mFence->getFenceiv(pname, params);
</del><ins>+ ASSERT(mFence->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->test(false) ? GL_TRUE : GL_FALSE);
+ return mStatus;
+ }
+
+ case GL_FENCE_CONDITION_NV:
+ return mCondition;
+
+ default: UNREACHABLE(); return 0;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+FenceSync::FenceSync(rx::Renderer *renderer, GLuint id)
+ : RefCountObject(id)
+{
+ mFence = renderer->createFence();
+
+ LARGE_INTEGER counterFreqency = { 0 };
+ BOOL success = QueryPerformanceFrequency(&counterFreqency);
+ ASSERT(success);
+
+ mCounterFrequency = counterFreqency.QuadPart;
</ins><span class="cx"> }
</span><ins>+
+FenceSync::~FenceSync()
+{
+ delete mFence;
+}
+
+void FenceSync::set(GLenum condition)
+{
+ mCondition = condition;
+ mFence->set();
+}
+
+GLenum FenceSync::clientWait(GLbitfield flags, GLuint64 timeout)
+{
+ ASSERT(mFence->isSet());
+
+ bool flushCommandBuffer = ((flags & GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
+
+ if (mFence->test(flushCommandBuffer))
+ {
+ return GL_ALREADY_SIGNALED;
+ }
+
+ if (mFence->hasError())
+ {
+ return GL_WAIT_FAILED;
+ }
+
+ if (timeout == 0)
+ {
+ return GL_TIMEOUT_EXPIRED;
+ }
+
+ LARGE_INTEGER currentCounter = { 0 };
+ BOOL success = QueryPerformanceCounter(&currentCounter);
+ ASSERT(success);
+
+ LONGLONG timeoutInSeconds = static_cast<LONGLONG>(timeout) * static_cast<LONGLONG>(1000000ll);
+ LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
+
+ while (currentCounter.QuadPart < endCounter && !mFence->test(flushCommandBuffer))
+ {
+ Sleep(0);
+ BOOL success = QueryPerformanceCounter(&currentCounter);
+ ASSERT(success);
+ }
+
+ if (mFence->hasError())
+ {
+ return GL_WAIT_FAILED;
+ }
+
+ if (currentCounter.QuadPart >= 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->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;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Fenceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,6 +10,7 @@
</span><span class="cx"> #define LIBGLESV2_FENCE_H_
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><ins>+#include "common/RefCountObject.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -20,24 +21,52 @@
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx">
</span><del>-class Fence
</del><ins>+class FenceNV
</ins><span class="cx"> {
</span><span class="cx"> public:
</span><del>- explicit Fence(rx::Renderer *renderer);
- virtual ~Fence();
</del><ins>+ explicit FenceNV(rx::Renderer *renderer);
+ virtual ~FenceNV();
</ins><span class="cx">
</span><del>- GLboolean isFence();
</del><ins>+ GLboolean isFence() const;
</ins><span class="cx"> void setFence(GLenum condition);
</span><span class="cx"> GLboolean testFence();
</span><span class="cx"> void finishFence();
</span><del>- void getFenceiv(GLenum pname, GLint *params);
</del><ins>+ GLint getFencei(GLenum pname);
</ins><span class="cx">
</span><ins>+ GLboolean getStatus() const { return mStatus; }
+ GLuint getCondition() const { return mCondition; }
+
</ins><span class="cx"> private:
</span><del>- DISALLOW_COPY_AND_ASSIGN(Fence);
</del><ins>+ DISALLOW_COPY_AND_ASSIGN(FenceNV);
</ins><span class="cx">
</span><span class="cx"> rx::FenceImpl *mFence;
</span><ins>+
+ GLboolean mStatus;
+ GLenum mCondition;
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+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;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // LIBGLESV2_FENCE_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Framebuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,7 +11,8 @@
</span><span class="cx"> #include "libGLESv2/Framebuffer.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/main.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
</ins><span class="cx"> #include "libGLESv2/Texture.h"
</span><span class="cx"> #include "libGLESv2/Context.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><span class="lines">@@ -25,91 +26,171 @@
</span><span class="cx"> {
</span><span class="cx"> for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
</span><span class="cx"> {
</span><del>- mColorbufferTypes[colorAttachment] = GL_NONE;
</del><span class="cx"> mDrawBufferStates[colorAttachment] = GL_NONE;
</span><span class="cx"> }
</span><span class="cx"> mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
</span><span class="cx"> mReadBufferState = GL_COLOR_ATTACHMENT0_EXT;
</span><del>-
- mDepthbufferType = GL_NONE;
- mStencilbufferType = GL_NONE;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Framebuffer::~Framebuffer()
</span><span class="cx"> {
</span><span class="cx"> for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
</span><span class="cx"> {
</span><del>- mColorbufferPointers[colorAttachment].set(NULL);
</del><ins>+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><del>- mDepthbufferPointer.set(NULL);
- mStencilbufferPointer.set(NULL);
</del><ins>+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const
</del><ins>+Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint level, GLint layer) const
</ins><span class="cx"> {
</span><span class="cx"> gl::Context *context = gl::getContext();
</span><del>- Renderbuffer *buffer = NULL;
</del><span class="cx">
</span><del>- if (type == GL_NONE)
</del><ins>+ switch (type)
</ins><span class="cx"> {
</span><del>- buffer = NULL;
</del><ins>+ case GL_NONE:
+ return NULL;
+
+ case GL_RENDERBUFFER:
+ return context->getRenderbuffer(handle);
+
+ case GL_TEXTURE_2D:
+ {
+ Texture *texture = context->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_2D)
+ {
+ return static_cast<Texture2D*>(texture)->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->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_CUBE_MAP)
+ {
+ return static_cast<TextureCubeMap*>(texture)->getRenderbuffer(type, level);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ case GL_TEXTURE_3D:
+ {
+ Texture *texture = context->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_3D)
+ {
+ return static_cast<Texture3D*>(texture)->getRenderbuffer(level, layer);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ Texture *texture = context->getTexture(handle);
+ if (texture && texture->getTarget() == GL_TEXTURE_2D_ARRAY)
+ {
+ return static_cast<Texture2DArray*>(texture)->getRenderbuffer(level, layer);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ default:
+ UNREACHABLE();
+ return NULL;
</ins><span class="cx"> }
</span><del>- else if (type == GL_RENDERBUFFER)
</del><ins>+}
+
+void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer)
+{
+ ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
+ Renderbuffer *renderBuffer = lookupRenderbuffer(type, colorbuffer, level, layer);
+ if (renderBuffer)
</ins><span class="cx"> {
</span><del>- buffer = context->getRenderbuffer(handle);
</del><ins>+ mColorbuffers[colorAttachment].set(renderBuffer, type, level, layer);
</ins><span class="cx"> }
</span><del>- else if (IsInternalTextureTarget(type))
- {
- buffer = context->getTexture(handle)->getRenderbuffer(type);
- }
</del><span class="cx"> else
</span><span class="cx"> {
</span><del>- UNREACHABLE();
</del><ins>+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><del>-
- return buffer;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer)
</del><ins>+void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer)
</ins><span class="cx"> {
</span><del>- ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
- mColorbufferTypes[colorAttachment] = (colorbuffer != 0) ? type : GL_NONE;
- mColorbufferPointers[colorAttachment].set(lookupRenderbuffer(type, colorbuffer));
</del><ins>+ Renderbuffer *renderBuffer = lookupRenderbuffer(type, depthbuffer, level, layer);
+ if (renderBuffer)
+ {
+ mDepthbuffer.set(renderBuffer, type, level, layer);
+ }
+ else
+ {
+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer)
</del><ins>+void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer)
</ins><span class="cx"> {
</span><del>- mDepthbufferType = (depthbuffer != 0) ? type : GL_NONE;
- mDepthbufferPointer.set(lookupRenderbuffer(type, depthbuffer));
</del><ins>+ Renderbuffer *renderBuffer = lookupRenderbuffer(type, stencilbuffer, level, layer);
+ if (renderBuffer)
+ {
+ mStencilbuffer.set(renderBuffer, type, level, layer);
+ }
+ else
+ {
+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer)
</del><ins>+void Framebuffer::setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer)
</ins><span class="cx"> {
</span><del>- mStencilbufferType = (stencilbuffer != 0) ? type : GL_NONE;
- mStencilbufferPointer.set(lookupRenderbuffer(type, stencilbuffer));
</del><ins>+ Renderbuffer *renderBuffer = lookupRenderbuffer(type, depthStencilBuffer, level, layer);
+ if (renderBuffer && renderBuffer->getDepthSize() > 0 && renderBuffer->getStencilSize() > 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);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Framebuffer::detachTexture(GLuint texture)
</span><span class="cx"> {
</span><span class="cx"> for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
</span><span class="cx"> {
</span><del>- if (mColorbufferPointers[colorAttachment].id() == texture && IsInternalTextureTarget(mColorbufferTypes[colorAttachment]))
</del><ins>+ if (mColorbuffers[colorAttachment].id() == texture &&
+ IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer->getCurrentClientVersion()))
</ins><span class="cx"> {
</span><del>- mColorbufferTypes[colorAttachment] = GL_NONE;
- mColorbufferPointers[colorAttachment].set(NULL);
</del><ins>+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mDepthbufferPointer.id() == texture && IsInternalTextureTarget(mDepthbufferType))
</del><ins>+ if (mDepthbuffer.id() == texture && IsInternalTextureTarget(mDepthbuffer.type(), mRenderer->getCurrentClientVersion()))
</ins><span class="cx"> {
</span><del>- mDepthbufferType = GL_NONE;
- mDepthbufferPointer.set(NULL);
</del><ins>+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (mStencilbufferPointer.id() == texture && IsInternalTextureTarget(mStencilbufferType))
</del><ins>+ if (mStencilbuffer.id() == texture && IsInternalTextureTarget(mStencilbuffer.type(), mRenderer->getCurrentClientVersion()))
</ins><span class="cx"> {
</span><del>- mStencilbufferType = GL_NONE;
- mStencilbufferPointer.set(NULL);
</del><ins>+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -117,23 +198,20 @@
</span><span class="cx"> {
</span><span class="cx"> for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
</span><span class="cx"> {
</span><del>- if (mColorbufferPointers[colorAttachment].id() == renderbuffer && mColorbufferTypes[colorAttachment] == GL_RENDERBUFFER)
</del><ins>+ if (mColorbuffers[colorAttachment].id() == renderbuffer && mColorbuffers[colorAttachment].type() == GL_RENDERBUFFER)
</ins><span class="cx"> {
</span><del>- mColorbufferTypes[colorAttachment] = GL_NONE;
- mColorbufferPointers[colorAttachment].set(NULL);
</del><ins>+ mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mDepthbufferPointer.id() == renderbuffer && mDepthbufferType == GL_RENDERBUFFER)
</del><ins>+ if (mDepthbuffer.id() == renderbuffer && mDepthbuffer.type() == GL_RENDERBUFFER)
</ins><span class="cx"> {
</span><del>- mDepthbufferType = GL_NONE;
- mDepthbufferPointer.set(NULL);
</del><ins>+ mDepthbuffer.set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (mStencilbufferPointer.id() == renderbuffer && mStencilbufferType == GL_RENDERBUFFER)
</del><ins>+ if (mStencilbuffer.id() == renderbuffer && mStencilbuffer.type() == GL_RENDERBUFFER)
</ins><span class="cx"> {
</span><del>- mStencilbufferType = GL_NONE;
- mStencilbufferPointer.set(NULL);
</del><ins>+ mStencilbuffer.set(NULL, GL_NONE, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -141,7 +219,7 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
</span><span class="cx">
</span><del>- Renderbuffer *colorbuffer = mColorbufferPointers[colorAttachment].get();
</del><ins>+ Renderbuffer *colorbuffer = mColorbuffers[colorAttachment].get();
</ins><span class="cx">
</span><span class="cx"> if (colorbuffer)
</span><span class="cx"> {
</span><span class="lines">@@ -153,7 +231,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned int Framebuffer::getDepthbufferSerial() const
</span><span class="cx"> {
</span><del>- Renderbuffer *depthbuffer = mDepthbufferPointer.get();
</del><ins>+ Renderbuffer *depthbuffer = mDepthbuffer.get();
</ins><span class="cx">
</span><span class="cx"> if (depthbuffer)
</span><span class="cx"> {
</span><span class="lines">@@ -165,7 +243,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned int Framebuffer::getStencilbufferSerial() const
</span><span class="cx"> {
</span><del>- Renderbuffer *stencilbuffer = mStencilbufferPointer.get();
</del><ins>+ Renderbuffer *stencilbuffer = mStencilbuffer.get();
</ins><span class="cx">
</span><span class="cx"> if (stencilbuffer)
</span><span class="cx"> {
</span><span class="lines">@@ -178,26 +256,31 @@
</span><span class="cx"> Renderbuffer *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
</span><span class="cx"> {
</span><span class="cx"> ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
</span><del>- return mColorbufferPointers[colorAttachment].get();
</del><ins>+ return mColorbuffers[colorAttachment].get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderbuffer *Framebuffer::getDepthbuffer() const
</span><span class="cx"> {
</span><del>- return mDepthbufferPointer.get();
</del><ins>+ return mDepthbuffer.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderbuffer *Framebuffer::getStencilbuffer() const
</span><span class="cx"> {
</span><del>- return mStencilbufferPointer.get();
</del><ins>+ return mStencilbuffer.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+Renderbuffer *Framebuffer::getDepthStencilBuffer() const
+{
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.get() : NULL;
+}
+
</ins><span class="cx"> Renderbuffer *Framebuffer::getDepthOrStencilbuffer() const
</span><span class="cx"> {
</span><del>- Renderbuffer *depthstencilbuffer = mDepthbufferPointer.get();
</del><ins>+ Renderbuffer *depthstencilbuffer = mDepthbuffer.get();
</ins><span class="cx">
</span><span class="cx"> if (!depthstencilbuffer)
</span><span class="cx"> {
</span><del>- depthstencilbuffer = mStencilbufferPointer.get();
</del><ins>+ depthstencilbuffer = mStencilbuffer.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return depthstencilbuffer;
</span><span class="lines">@@ -206,22 +289,22 @@
</span><span class="cx"> Renderbuffer *Framebuffer::getReadColorbuffer() const
</span><span class="cx"> {
</span><span class="cx"> // Will require more logic if glReadBuffers is supported
</span><del>- return mColorbufferPointers[0].get();
</del><ins>+ return mColorbuffers[0].get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum Framebuffer::getReadColorbufferType() const
</span><span class="cx"> {
</span><span class="cx"> // Will require more logic if glReadBuffers is supported
</span><del>- return mColorbufferTypes[0];
</del><ins>+ return mColorbuffers[0].type();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderbuffer *Framebuffer::getFirstColorbuffer() const
</span><span class="cx"> {
</span><span class="cx"> for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
</span><span class="cx"> {
</span><del>- if (mColorbufferTypes[colorAttachment] != GL_NONE)
</del><ins>+ if (mColorbuffers[colorAttachment].type() != GL_NONE)
</ins><span class="cx"> {
</span><del>- return mColorbufferPointers[colorAttachment].get();
</del><ins>+ return mColorbuffers[colorAttachment].get();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -231,35 +314,87 @@
</span><span class="cx"> GLenum Framebuffer::getColorbufferType(unsigned int colorAttachment) const
</span><span class="cx"> {
</span><span class="cx"> ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
</span><del>- return mColorbufferTypes[colorAttachment];
</del><ins>+ return mColorbuffers[colorAttachment].type();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum Framebuffer::getDepthbufferType() const
</span><span class="cx"> {
</span><del>- return mDepthbufferType;
</del><ins>+ return mDepthbuffer.type();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum Framebuffer::getStencilbufferType() const
</span><span class="cx"> {
</span><del>- return mStencilbufferType;
</del><ins>+ return mStencilbuffer.type();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+GLenum Framebuffer::getDepthStencilbufferType() const
+{
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.type() : GL_NONE;
+}
+
</ins><span class="cx"> GLuint Framebuffer::getColorbufferHandle(unsigned int colorAttachment) const
</span><span class="cx"> {
</span><span class="cx"> ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
</span><del>- return mColorbufferPointers[colorAttachment].id();
</del><ins>+ return mColorbuffers[colorAttachment].id();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Framebuffer::getDepthbufferHandle() const
</span><span class="cx"> {
</span><del>- return mDepthbufferPointer.id();
</del><ins>+ return mDepthbuffer.id();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Framebuffer::getStencilbufferHandle() const
</span><span class="cx"> {
</span><del>- return mStencilbufferPointer.id();
</del><ins>+ return mStencilbuffer.id();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+GLenum Framebuffer::getDepthStencilbufferHandle() const
+{
+ return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.id() : 0;
+}
+
+GLenum Framebuffer::getColorbufferMipLevel(unsigned int colorAttachment) const
+{
+ ASSERT(colorAttachment < 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 < 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;
+}
+
</ins><span class="cx"> GLenum Framebuffer::getDrawBufferState(unsigned int colorAttachment) const
</span><span class="cx"> {
</span><span class="cx"> return mDrawBufferStates[colorAttachment];
</span><span class="lines">@@ -272,7 +407,7 @@
</span><span class="cx">
</span><span class="cx"> bool Framebuffer::isEnabledColorAttachment(unsigned int colorAttachment) const
</span><span class="cx"> {
</span><del>- return (mColorbufferTypes[colorAttachment] != GL_NONE && mDrawBufferStates[colorAttachment] != GL_NONE);
</del><ins>+ return (mColorbuffers[colorAttachment].type() != GL_NONE && mDrawBufferStates[colorAttachment] != GL_NONE);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Framebuffer::hasEnabledColorAttachment() const
</span><span class="lines">@@ -290,7 +425,7 @@
</span><span class="cx">
</span><span class="cx"> bool Framebuffer::hasStencil() const
</span><span class="cx"> {
</span><del>- if (mStencilbufferType != GL_NONE)
</del><ins>+ if (mStencilbuffer.type() != GL_NONE)
</ins><span class="cx"> {
</span><span class="cx"> const Renderbuffer *stencilbufferObject = getStencilbuffer();
</span><span class="cx">
</span><span class="lines">@@ -320,13 +455,14 @@
</span><span class="cx"> {
</span><span class="cx"> int width = 0;
</span><span class="cx"> int height = 0;
</span><del>- int colorbufferSize = 0;
</del><ins>+ unsigned int colorbufferSize = 0;
</ins><span class="cx"> int samples = -1;
</span><span class="cx"> bool missingAttachment = true;
</span><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
</ins><span class="cx">
</span><span class="cx"> for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
</span><span class="cx"> {
</span><del>- if (mColorbufferTypes[colorAttachment] != GL_NONE)
</del><ins>+ if (mColorbuffers[colorAttachment].type() != GL_NONE)
</ins><span class="cx"> {
</span><span class="cx"> const Renderbuffer *colorbuffer = getColorbuffer(colorAttachment);
</span><span class="cx">
</span><span class="lines">@@ -340,36 +476,25 @@
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mColorbufferTypes[colorAttachment] == GL_RENDERBUFFER)
</del><ins>+ if (mColorbuffers[colorAttachment].type() == GL_RENDERBUFFER)
</ins><span class="cx"> {
</span><del>- if (!gl::IsColorRenderable(colorbuffer->getInternalFormat()))
</del><ins>+ if (!gl::IsColorRenderingSupported(colorbuffer->getInternalFormat(), mRenderer))
</ins><span class="cx"> {
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (IsInternalTextureTarget(mColorbufferTypes[colorAttachment]))
</del><ins>+ else if (IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer->getCurrentClientVersion()))
</ins><span class="cx"> {
</span><del>- GLint internalformat = colorbuffer->getInternalFormat();
- GLenum format = gl::ExtractFormat(internalformat);
</del><ins>+ GLenum internalformat = colorbuffer->getInternalFormat();
</ins><span class="cx">
</span><del>- if (IsCompressed(format) ||
- format == GL_ALPHA ||
- format == GL_LUMINANCE ||
- format == GL_LUMINANCE_ALPHA)
</del><ins>+ if (!gl::IsColorRenderingSupported(internalformat, mRenderer))
</ins><span class="cx"> {
</span><span class="cx"> return GL_FRAMEBUFFER_UNSUPPORTED;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool filtering, renderable;
-
- if ((gl::IsFloat32Format(internalformat) && !mRenderer->getFloat32TextureSupport(&filtering, &renderable)) ||
- (gl::IsFloat16Format(internalformat) && !mRenderer->getFloat16TextureSupport(&filtering, &renderable)))
</del><ins>+ if (gl::GetDepthBits(internalformat, clientVersion) > 0 ||
+ gl::GetStencilBits(internalformat, clientVersion) > 0)
</ins><span class="cx"> {
</span><del>- return GL_FRAMEBUFFER_UNSUPPORTED;
- }
-
- if (gl::IsDepthTexture(internalformat) || gl::IsStencilTexture(internalformat))
- {
</del><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -394,16 +519,20 @@
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // all color attachments attachments must have the same number of bitplanes
- if (gl::ComputePixelSize(colorbuffer->getInternalFormat()) != colorbufferSize)
</del><ins>+ // 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 < 3)
</ins><span class="cx"> {
</span><del>- return GL_FRAMEBUFFER_UNSUPPORTED;
</del><ins>+ if (gl::GetPixelBytes(colorbuffer->getInternalFormat(), clientVersion) != colorbufferSize)
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness
</span><span class="cx"> for (unsigned int previousColorAttachment = 0; previousColorAttachment < colorAttachment; previousColorAttachment++)
</span><span class="cx"> {
</span><del>- if (mColorbufferPointers[colorAttachment].get() == mColorbufferPointers[previousColorAttachment].get())
</del><ins>+ if (mColorbuffers[colorAttachment].get() == mColorbuffers[previousColorAttachment].get())
</ins><span class="cx"> {
</span><span class="cx"> return GL_FRAMEBUFFER_UNSUPPORTED;
</span><span class="cx"> }
</span><span class="lines">@@ -414,7 +543,7 @@
</span><span class="cx"> width = colorbuffer->getWidth();
</span><span class="cx"> height = colorbuffer->getHeight();
</span><span class="cx"> samples = colorbuffer->getSamples();
</span><del>- colorbufferSize = gl::ComputePixelSize(colorbuffer->getInternalFormat());
</del><ins>+ colorbufferSize = gl::GetPixelBytes(colorbuffer->getInternalFormat(), clientVersion);
</ins><span class="cx"> missingAttachment = false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -423,7 +552,7 @@
</span><span class="cx"> const Renderbuffer *depthbuffer = NULL;
</span><span class="cx"> const Renderbuffer *stencilbuffer = NULL;
</span><span class="cx">
</span><del>- if (mDepthbufferType != GL_NONE)
</del><ins>+ if (mDepthbuffer.type() != GL_NONE)
</ins><span class="cx"> {
</span><span class="cx"> depthbuffer = getDepthbuffer();
</span><span class="cx">
</span><span class="lines">@@ -437,16 +566,16 @@
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mDepthbufferType == GL_RENDERBUFFER)
</del><ins>+ if (mDepthbuffer.type() == GL_RENDERBUFFER)
</ins><span class="cx"> {
</span><del>- if (!gl::IsDepthRenderable(depthbuffer->getInternalFormat()))
</del><ins>+ if (!gl::IsDepthRenderingSupported(depthbuffer->getInternalFormat(), mRenderer))
</ins><span class="cx"> {
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (IsInternalTextureTarget(mDepthbufferType))
</del><ins>+ else if (IsInternalTextureTarget(mDepthbuffer.type(), mRenderer->getCurrentClientVersion()))
</ins><span class="cx"> {
</span><del>- GLint internalformat = depthbuffer->getInternalFormat();
</del><ins>+ GLenum internalformat = depthbuffer->getInternalFormat();
</ins><span class="cx">
</span><span class="cx"> // depth texture attachments require OES/ANGLE_depth_texture
</span><span class="cx"> if (!mRenderer->getDepthTextureSupport())
</span><span class="lines">@@ -454,7 +583,7 @@
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!gl::IsDepthTexture(internalformat))
</del><ins>+ if (gl::GetDepthBits(internalformat, clientVersion) == 0)
</ins><span class="cx"> {
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="lines">@@ -482,7 +611,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mStencilbufferType != GL_NONE)
</del><ins>+ if (mStencilbuffer.type() != GL_NONE)
</ins><span class="cx"> {
</span><span class="cx"> stencilbuffer = getStencilbuffer();
</span><span class="cx">
</span><span class="lines">@@ -496,16 +625,16 @@
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mStencilbufferType == GL_RENDERBUFFER)
</del><ins>+ if (mStencilbuffer.type() == GL_RENDERBUFFER)
</ins><span class="cx"> {
</span><del>- if (!gl::IsStencilRenderable(stencilbuffer->getInternalFormat()))
</del><ins>+ if (!gl::IsStencilRenderingSupported(stencilbuffer->getInternalFormat(), mRenderer))
</ins><span class="cx"> {
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (IsInternalTextureTarget(mStencilbufferType))
</del><ins>+ else if (IsInternalTextureTarget(mStencilbuffer.type(), mRenderer->getCurrentClientVersion()))
</ins><span class="cx"> {
</span><del>- GLint internalformat = stencilbuffer->getInternalFormat();
</del><ins>+ GLenum internalformat = stencilbuffer->getInternalFormat();
</ins><span class="cx">
</span><span class="cx"> // texture stencil attachments come along as part
</span><span class="cx"> // of OES_packed_depth_stencil + OES/ANGLE_depth_texture
</span><span class="lines">@@ -514,7 +643,7 @@
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!gl::IsStencilTexture(internalformat))
</del><ins>+ if (gl::GetStencilBits(internalformat, clientVersion) == 0)
</ins><span class="cx"> {
</span><span class="cx"> return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
</span><span class="cx"> }
</span><span class="lines">@@ -561,16 +690,12 @@
</span><span class="cx"> DefaultFramebuffer::DefaultFramebuffer(rx::Renderer *renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
</span><span class="cx"> : Framebuffer(renderer)
</span><span class="cx"> {
</span><del>- mColorbufferPointers[0].set(new Renderbuffer(mRenderer, 0, colorbuffer));
</del><ins>+ mColorbuffers[0].set(new Renderbuffer(mRenderer, 0, colorbuffer), GL_RENDERBUFFER, 0, 0);
</ins><span class="cx">
</span><span class="cx"> Renderbuffer *depthStencilRenderbuffer = new Renderbuffer(mRenderer, 0, depthStencil);
</span><del>- mDepthbufferPointer.set(depthStencilRenderbuffer);
- mStencilbufferPointer.set(depthStencilRenderbuffer);
</del><ins>+ mDepthbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
+ mStencilbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
</ins><span class="cx">
</span><del>- mColorbufferTypes[0] = GL_RENDERBUFFER;
- mDepthbufferType = (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
- mStencilbufferType = (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE;
-
</del><span class="cx"> mDrawBufferStates[0] = GL_BACK;
</span><span class="cx"> mReadBufferState = GL_BACK;
</span><span class="cx"> }
</span><span class="lines">@@ -583,7 +708,7 @@
</span><span class="cx"> // in this case return the first nonzero sample size
</span><span class="cx"> for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
</span><span class="cx"> {
</span><del>- if (mColorbufferTypes[colorAttachment] != GL_NONE)
</del><ins>+ if (mColorbuffers[colorAttachment].type() != GL_NONE)
</ins><span class="cx"> {
</span><span class="cx"> return getColorbuffer(colorAttachment)->getSamples();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Framebufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><span class="cx"> #include "common/RefCountObject.h"
</span><del>-#include "Constants.h"
</del><ins>+#include "constants.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -34,9 +34,10 @@
</span><span class="cx">
</span><span class="cx"> virtual ~Framebuffer();
</span><span class="cx">
</span><del>- void setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer);
- void setDepthbuffer(GLenum type, GLuint depthbuffer);
- void setStencilbuffer(GLenum type, GLuint stencilbuffer);
</del><ins>+ 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);
</ins><span class="cx">
</span><span class="cx"> void detachTexture(GLuint texture);
</span><span class="cx"> void detachRenderbuffer(GLuint renderbuffer);
</span><span class="lines">@@ -48,6 +49,7 @@
</span><span class="cx"> Renderbuffer *getColorbuffer(unsigned int colorAttachment) const;
</span><span class="cx"> Renderbuffer *getDepthbuffer() const;
</span><span class="cx"> Renderbuffer *getStencilbuffer() const;
</span><ins>+ Renderbuffer *getDepthStencilBuffer() const;
</ins><span class="cx"> Renderbuffer *getDepthOrStencilbuffer() const;
</span><span class="cx"> Renderbuffer *getReadColorbuffer() const;
</span><span class="cx"> GLenum getReadColorbufferType() const;
</span><span class="lines">@@ -56,11 +58,23 @@
</span><span class="cx"> GLenum getColorbufferType(unsigned int colorAttachment) const;
</span><span class="cx"> GLenum getDepthbufferType() const;
</span><span class="cx"> GLenum getStencilbufferType() const;
</span><ins>+ GLenum getDepthStencilbufferType() const;
</ins><span class="cx">
</span><span class="cx"> GLuint getColorbufferHandle(unsigned int colorAttachment) const;
</span><span class="cx"> GLuint getDepthbufferHandle() const;
</span><span class="cx"> GLuint getStencilbufferHandle() const;
</span><ins>+ GLenum getDepthStencilbufferHandle() const;
</ins><span class="cx">
</span><ins>+ 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;
+
</ins><span class="cx"> GLenum getDrawBufferState(unsigned int colorAttachment) const;
</span><span class="cx"> void setDrawBufferState(unsigned int colorAttachment, GLenum drawBuffer);
</span><span class="cx">
</span><span class="lines">@@ -73,23 +87,19 @@
</span><span class="cx"> virtual GLenum completeness() const;
</span><span class="cx">
</span><span class="cx"> protected:
</span><del>- GLenum mColorbufferTypes[IMPLEMENTATION_MAX_DRAW_BUFFERS];
- BindingPointer<Renderbuffer> mColorbufferPointers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
</del><ins>+ FramebufferTextureBindingPointer<Renderbuffer> mColorbuffers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
</ins><span class="cx"> GLenum mDrawBufferStates[IMPLEMENTATION_MAX_DRAW_BUFFERS];
</span><span class="cx"> GLenum mReadBufferState;
</span><span class="cx">
</span><del>- GLenum mDepthbufferType;
- BindingPointer<Renderbuffer> mDepthbufferPointer;
</del><ins>+ FramebufferTextureBindingPointer<Renderbuffer> mDepthbuffer;
+ FramebufferTextureBindingPointer<Renderbuffer> mStencilbuffer;
</ins><span class="cx">
</span><del>- GLenum mStencilbufferType;
- BindingPointer<Renderbuffer> mStencilbufferPointer;
-
</del><span class="cx"> rx::Renderer *mRenderer;
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Framebuffer);
</span><span class="cx">
</span><del>- Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle) const;
</del><ins>+ Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle, GLint level, GLint layer) const;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class DefaultFramebuffer : public Framebuffer
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2HandleAllocatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> #define LIBGLESV2_HANDLEALLOCATOR_H_
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><span class="cx"> #include <vector>
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Programcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</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">@@ -95,36 +95,42 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- char info[1024];
-
</del><span class="cx"> va_list vararg;
</span><span class="cx"> va_start(vararg, format);
</span><del>- vsnprintf(info, sizeof(info), format, vararg);
</del><ins>+ size_t infoLength = vsnprintf(NULL, 0, format, vararg);
</ins><span class="cx"> va_end(vararg);
</span><span class="cx">
</span><del>- size_t infoLength = strlen(info);
</del><ins>+ char *logPointer = NULL;
+ size_t logLength = 0;
</ins><span class="cx">
</span><span class="cx"> if (!mInfoLog)
</span><span class="cx"> {
</span><del>- const size_t newInfoLogLength = infoLength + 2;
- mInfoLog = new char[newInfoLogLength];
- strncpy(mInfoLog, info, newInfoLogLength);
- strncpy(mInfoLog + infoLength, "\n", newInfoLogLength - infoLength);
- mInfoLog[newInfoLogLength - 1] = '\0';
</del><ins>+ mInfoLog = new char[infoLength + 2];
+ logPointer = mInfoLog;
+ logLength = infoLenfth + 2;
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- size_t logLength = strlen(mInfoLog);
- const size_t newInfoLogLength = logLength + infoLength + 2;
</del><ins>+ size_t currentlogLength = strlen(mInfoLog);
+ size_t newInfoLogLength = currentlogLength + infoLength + 2;
</ins><span class="cx"> char *newLog = new char[newInfoLogLength];
</span><span class="cx"> strncpy(newLog, mInfoLog, newInfoLogLength);
</span><del>- strncpy(newLog + logLength, info, newInfoLogLength - logLength);
- strncpy(newLog + logLength + infoLength, "\n", newInfoLogLength - logLength - infoLength);
</del><span class="cx"> newLog[newInfoLogLength - 1] = '\0';
</span><span class="cx">
</span><span class="cx"> delete[] mInfoLog;
</span><span class="cx"> mInfoLog = newLog;
</span><ins>+
+ logPointer = mInfoLog + currentlogLength;
+ logLength = newInfoLogLength - currentlogLength;
</ins><span class="cx"> }
</span><ins>+
+ va_start(vararg, format);
+ vsnprintf(logPointer, infoLength, format, vararg);
+ va_end(vararg);
+
+ logPointer[infoLength] = 0;
+ strncpy(logPointer + infoLength, "\n", logLength - infoLength);
+ logPointer[logLength - 1] = '\0';
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void InfoLog::reset()
</span><span class="lines">@@ -145,6 +151,8 @@
</span><span class="cx"> mLinked = false;
</span><span class="cx"> mRefCount = 0;
</span><span class="cx"> mRenderer = renderer;
</span><ins>+
+ resetUniformBlockBindings();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Program::~Program()
</span><span class="lines">@@ -247,9 +255,11 @@
</span><span class="cx"> unlink(false);
</span><span class="cx">
</span><span class="cx"> mInfoLog.reset();
</span><ins>+ resetUniformBlockBindings();
</ins><span class="cx">
</span><span class="cx"> mProgramBinary.set(new ProgramBinary(mRenderer));
</span><del>- mLinked = mProgramBinary->link(mInfoLog, mAttributeBindings, mFragmentShader, mVertexShader);
</del><ins>+ mLinked = mProgramBinary->link(mInfoLog, mAttributeBindings, mFragmentShader, mVertexShader,
+ mTransformFeedbackVaryings, mTransformFeedbackBufferMode);
</ins><span class="cx">
</span><span class="cx"> return mLinked;
</span><span class="cx"> }
</span><span class="lines">@@ -294,7 +304,7 @@
</span><span class="cx"> return mLinked;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ProgramBinary* Program::getProgramBinary()
</del><ins>+ProgramBinary* Program::getProgramBinary() const
</ins><span class="cx"> {
</span><span class="cx"> return mProgramBinary.get();
</span><span class="cx"> }
</span><span class="lines">@@ -526,4 +536,132 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLint Program::getActiveUniformBlockCount()
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ return static_cast<GLint>(programBinary->getActiveUniformBlockCount());
+ }
+ else
+ {
+ return 0;
+ }
</ins><span class="cx"> }
</span><ins>+
+GLint Program::getActiveUniformBlockMaxLength()
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ return static_cast<GLint>(programBinary->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 < 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 < 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 && index < programBinary->getTransformFeedbackVaryingCount())
+ {
+ const LinkedVarying &varying = programBinary->getTransformFeedbackVarying(index);
+ GLsizei lastNameIdx = std::min(bufSize - 1, static_cast<GLsizei>(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<GLsizei>(programBinary->getTransformFeedbackVaryingCount());
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLsizei Program::getTransformFeedbackVaryingMaxLength() const
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ GLsizei maxSize = 0;
+ for (size_t i = 0; i < programBinary->getTransformFeedbackVaryingCount(); i++)
+ {
+ const LinkedVarying &varying = programBinary->getTransformFeedbackVarying(i);
+ maxSize = std::max(maxSize, static_cast<GLsizei>(varying.name.length() + 1));
+ }
+
+ return maxSize;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLenum Program::getTransformFeedbackBufferMode() const
+{
+ ProgramBinary *programBinary = getProgramBinary();
+ if (programBinary)
+ {
+ return programBinary->getTransformFeedbackBufferMode();
+ }
+ else
+ {
+ return mTransformFeedbackBufferMode;
+ }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Programh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 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">@@ -78,7 +78,7 @@
</span><span class="cx"> bool link();
</span><span class="cx"> bool isLinked();
</span><span class="cx"> bool setProgramBinary(const void *binary, GLsizei length);
</span><del>- ProgramBinary *getProgramBinary();
</del><ins>+ ProgramBinary *getProgramBinary() const;
</ins><span class="cx">
</span><span class="cx"> int getInfoLogLength() const;
</span><span class="cx"> void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
</span><span class="lines">@@ -92,6 +92,18 @@
</span><span class="cx"> GLint getActiveUniformCount();
</span><span class="cx"> GLint getActiveUniformMaxLength();
</span><span class="cx">
</span><ins>+ 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;
+
</ins><span class="cx"> void addRef();
</span><span class="cx"> void release();
</span><span class="cx"> unsigned int getRefCount() const;
</span><span class="lines">@@ -107,12 +119,18 @@
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Program);
</span><span class="cx">
</span><span class="cx"> void unlink(bool destroy = false);
</span><ins>+ void resetUniformBlockBindings();
</ins><span class="cx">
</span><span class="cx"> FragmentShader *mFragmentShader;
</span><span class="cx"> VertexShader *mVertexShader;
</span><span class="cx">
</span><span class="cx"> AttributeBindings mAttributeBindings;
</span><span class="cx">
</span><ins>+ GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
+
+ std::vector<std::string> mTransformFeedbackVaryings;
+ GLuint mTransformFeedbackBufferMode;
+
</ins><span class="cx"> BindingPointer<ProgramBinary> mProgramBinary;
</span><span class="cx"> bool mLinked;
</span><span class="cx"> bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ProgramBinarycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</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">@@ -14,46 +14,132 @@
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><span class="cx"> #include "common/version.h"
</span><del>-#include "utilities.h"
</del><ins>+#include "common/utilities.h"
</ins><span class="cx">
</span><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx"> #include "libGLESv2/Shader.h"
</span><span class="cx"> #include "libGLESv2/Program.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><span class="cx"> #include "libGLESv2/renderer/VertexDataManager.h"
</span><ins>+#include "libGLESv2/Context.h"
+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/DynamicHLSL.h"
</ins><span class="cx">
</span><span class="cx"> #undef near
</span><span class="cx"> #undef far
</span><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><del>-std::string str(int i)
</del><ins>+
+namespace
</ins><span class="cx"> {
</span><del>- char buffer[20];
- snprintf(buffer, sizeof(buffer), "%d", i);
- return buffer;
</del><ins>+
+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->find_last_of('[');
+ size_t close = name->find_last_of(']');
+ if (open != std::string::npos && close == name->length() - 1)
+ {
+ subscript = atoi(name->substr(open + 1).c_str());
+ name->erase(open);
+ }
+
+ return subscript;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static rx::D3DWorkaroundType DiscardWorkaround(bool usesDiscard)
</del><ins>+void GetInputLayoutFromShader(const std::vector<gl::Attribute> &shaderAttributes, VertexFormat inputLayout[MAX_VERTEX_ATTRIBS])
</ins><span class="cx"> {
</span><del>- return (usesDiscard ? rx::ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER : rx::ANGLE_D3D_WORKAROUND_NONE);
</del><ins>+ size_t layoutIndex = 0;
+ for (size_t attributeIndex = 0; attributeIndex < shaderAttributes.size(); attributeIndex++)
+ {
+ ASSERT(layoutIndex < MAX_VERTEX_ATTRIBS);
+
+ const gl::Attribute &shaderAttr = shaderAttributes[attributeIndex];
+
+ if (shaderAttr.type != GL_NONE)
+ {
+ GLenum transposedType = TransposeMatrixType(shaderAttr.type);
+
+ for (size_t rowIndex = 0; static_cast<int>(rowIndex) < VariableRowCount(transposedType); rowIndex++, layoutIndex++)
+ {
+ VertexFormat *defaultFormat = &inputLayout[layoutIndex];
+
+ defaultFormat->mType = UniformComponentType(transposedType);
+ defaultFormat->mNormalized = false;
+ defaultFormat->mPureInteger = (defaultFormat->mType != GL_FLOAT); // note: inputs can not be bool
+ defaultFormat->mComponents = VariableColumnCount(transposedType);
+ }
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-UniformLocation::UniformLocation(const std::string &name, unsigned int element, unsigned int index)
</del><ins>+}
+
+VariableLocation::VariableLocation(const std::string &name, unsigned int element, unsigned int index)
</ins><span class="cx"> : name(name), element(element), index(index)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int ProgramBinary::mCurrentSerial = 1;
</del><ins>+ProgramBinary::VertexExecutable::VertexExecutable(rx::Renderer *const renderer,
+ const VertexFormat inputLayout[],
+ rx::ShaderExecutable *shaderExecutable)
+ : mShaderExecutable(shaderExecutable)
+{
+ for (size_t attributeIndex = 0; attributeIndex < gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ mInputs[attributeIndex] = inputLayout[attributeIndex];
+ }
+}
</ins><span class="cx">
</span><del>-ProgramBinary::ProgramBinary(rx::Renderer *renderer) : mRenderer(renderer), RefCountObject(0), mSerial(issueSerial())
</del><ins>+ProgramBinary::VertexExecutable::~VertexExecutable()
</ins><span class="cx"> {
</span><del>- mPixelExecutable = NULL;
- mVertexExecutable = NULL;
- mGeometryExecutable = NULL;
</del><ins>+ delete mShaderExecutable;
+}
</ins><span class="cx">
</span><del>- mValidated = false;
</del><ins>+bool ProgramBinary::VertexExecutable::matchesInputLayout(const VertexFormat attributes[]) const
+{
+ for (size_t attributeIndex = 0; attributeIndex < gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ if (mInputs[attributeIndex] != attributes[attributeIndex])
+ {
+ return false;
+ }
+ }
</ins><span class="cx">
</span><ins>+ return true;
+}
+
+LinkedVarying::LinkedVarying()
+{
+}
+
+LinkedVarying::LinkedVarying(const std::string &name, GLenum type, GLsizei size, const std::string &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())
+{
</ins><span class="cx"> for (int index = 0; index < MAX_VERTEX_ATTRIBS; index++)
</span><span class="cx"> {
</span><span class="cx"> mSemanticIndex[index] = -1;
</span><span class="lines">@@ -69,27 +155,35 @@
</span><span class="cx"> mSamplersVS[index].active = false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mUsedVertexSamplerRange = 0;
- mUsedPixelSamplerRange = 0;
- mUsesPointSize = false;
</del><ins>+ mDynamicHLSL = new DynamicHLSL(renderer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ProgramBinary::~ProgramBinary()
</span><span class="cx"> {
</span><del>- delete mPixelExecutable;
- mPixelExecutable = NULL;
</del><ins>+ while (!mVertexExecutables.empty())
+ {
+ delete mVertexExecutables.back();
+ mVertexExecutables.pop_back();
+ }
</ins><span class="cx">
</span><del>- delete mVertexExecutable;
- mVertexExecutable = NULL;
</del><ins>+ SafeDelete(mGeometryExecutable);
+ SafeDelete(mPixelExecutable);
</ins><span class="cx">
</span><del>- delete mGeometryExecutable;
- mGeometryExecutable = NULL;
-
</del><span class="cx"> while (!mUniforms.empty())
</span><span class="cx"> {
</span><span class="cx"> delete mUniforms.back();
</span><span class="cx"> mUniforms.pop_back();
</span><span class="cx"> }
</span><ins>+
+ while (!mUniformBlocks.empty())
+ {
+ delete mUniformBlocks.back();
+ mUniformBlocks.pop_back();
+ }
+
+ SafeDelete(mVertexUniformStorage);
+ SafeDelete(mFragmentUniformStorage);
+ SafeDelete(mDynamicHLSL);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> unsigned int ProgramBinary::getSerial() const
</span><span class="lines">@@ -97,22 +191,62 @@
</span><span class="cx"> return mSerial;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int ProgramBinary::getShaderVersion() const
+{
+ return mShaderVersion;
+}
+
</ins><span class="cx"> unsigned int ProgramBinary::issueSerial()
</span><span class="cx"> {
</span><span class="cx"> return mCurrentSerial++;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-rx::ShaderExecutable *ProgramBinary::getPixelExecutable()
</del><ins>+rx::ShaderExecutable *ProgramBinary::getPixelExecutable() const
</ins><span class="cx"> {
</span><span class="cx"> return mPixelExecutable;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-rx::ShaderExecutable *ProgramBinary::getVertexExecutable()
</del><ins>+rx::ShaderExecutable *ProgramBinary::getVertexExecutableForInputLayout(const VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS])
</ins><span class="cx"> {
</span><del>- return mVertexExecutable;
</del><ins>+ for (size_t executableIndex = 0; executableIndex < mVertexExecutables.size(); executableIndex++)
+ {
+ if (mVertexExecutables[executableIndex]->matchesInputLayout(inputLayout))
+ {
+ return mVertexExecutables[executableIndex]->shaderExecutable();
+ }
+ }
+
+ // Generate new dynamic layout with attribute conversions
+ const std::string &layoutHLSL = mDynamicHLSL->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->compileToExecutable(tempInfoLog, vertexHLSL.c_str(),
+ rx::SHADER_VERTEX,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+ mVertexWorkarounds);
+
+ if (!vertexExecutable)
+ {
+ std::vector<char> tempCharBuffer(tempInfoLog.getLength()+3);
+ tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &tempCharBuffer[0]);
+ ERR("Error compiling dynamic vertex executable:\n%s\n", &tempCharBuffer[0]);
+ }
+ else
+ {
+ mVertexExecutables.push_back(new VertexExecutable(mRenderer, inputLayout, vertexExecutable));
+ }
+
+ return vertexExecutable;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-rx::ShaderExecutable *ProgramBinary::getGeometryExecutable()
</del><ins>+rx::ShaderExecutable *ProgramBinary::getGeometryExecutable() const
</ins><span class="cx"> {
</span><span class="cx"> return mGeometryExecutable;
</span><span class="cx"> }
</span><span class="lines">@@ -227,144 +361,125 @@
</span><span class="cx">
</span><span class="cx"> GLint ProgramBinary::getUniformLocation(std::string name)
</span><span class="cx"> {
</span><del>- unsigned int subscript = 0;
</del><ins>+ unsigned int subscript = ParseAndStripArrayIndex(&name);
</ins><span class="cx">
</span><del>- // Strip any trailing array operator and retrieve the subscript
- size_t open = name.find_last_of('[');
- size_t close = name.find_last_of(']');
- if (open != std::string::npos && close == name.length() - 1)
- {
- subscript = atoi(name.substr(open + 1).c_str());
- name.erase(open);
- }
-
</del><span class="cx"> unsigned int numUniforms = mUniformIndex.size();
</span><span class="cx"> for (unsigned int location = 0; location < numUniforms; location++)
</span><span class="cx"> {
</span><del>- if (mUniformIndex[location].name == name &&
- mUniformIndex[location].element == subscript)
</del><ins>+ if (mUniformIndex[location].name == name)
</ins><span class="cx"> {
</span><del>- return location;
</del><ins>+ const int index = mUniformIndex[location].index;
+ const bool isArray = mUniforms[index]->isArray();
+
+ if ((isArray && mUniformIndex[location].element == subscript) ||
+ (subscript == GL_INVALID_INDEX))
+ {
+ return location;
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return -1;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
</del><ins>+GLuint ProgramBinary::getUniformIndex(std::string name)
</ins><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
</del><ins>+ unsigned int subscript = ParseAndStripArrayIndex(&name);
+
+ // The app is not allowed to specify array indices other than 0 for arrays of basic types
+ if (subscript != 0 && subscript != GL_INVALID_INDEX)
</ins><span class="cx"> {
</span><del>- return false;
</del><ins>+ return GL_INVALID_INDEX;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 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->type == GL_FLOAT)
</del><ins>+ unsigned int numUniforms = mUniforms.size();
+ for (unsigned int index = 0; index < numUniforms; index++)
</ins><span class="cx"> {
</span><del>- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
</del><ins>+ if (mUniforms[index]->name == name)
</ins><span class="cx"> {
</span><del>- target[0] = v[0];
- target[1] = 0;
- target[2] = 0;
- target[3] = 0;
- target += 4;
- v += 1;
</del><ins>+ if (mUniforms[index]->isArray() || subscript == GL_INVALID_INDEX)
+ {
+ return index;
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (targetUniform->type == GL_BOOL)
</del><ins>+
+ return GL_INVALID_INDEX;
+}
+
+GLuint ProgramBinary::getUniformBlockIndex(std::string name)
+{
+ unsigned int subscript = ParseAndStripArrayIndex(&name);
+
+ unsigned int numUniformBlocks = mUniformBlocks.size();
+ for (unsigned int blockIndex = 0; blockIndex < numUniformBlocks; blockIndex++)
</ins><span class="cx"> {
</span><del>- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
</del><ins>+ const UniformBlock &uniformBlock = *mUniformBlocks[blockIndex];
+ if (uniformBlock.name == name)
</ins><span class="cx"> {
</span><del>- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = GL_FALSE;
- boolParams[2] = GL_FALSE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 1;
</del><ins>+ const bool arrayElementZero = (subscript == GL_INVALID_INDEX && uniformBlock.elementIndex == 0);
+ if (subscript == uniformBlock.elementIndex || arrayElementZero)
+ {
+ return blockIndex;
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else
- {
- return false;
- }
</del><span class="cx">
</span><del>- return true;
</del><ins>+ return GL_INVALID_INDEX;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
</del><ins>+UniformBlock *ProgramBinary::getUniformBlockByIndex(GLuint blockIndex)
</ins><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
</del><ins>+ ASSERT(blockIndex < mUniformBlocks.size());
+ return mUniformBlocks[blockIndex];
+}
</ins><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
</del><ins>+GLint ProgramBinary::getFragDataLocation(const char *name) const
+{
+ std::string baseName(name);
+ unsigned int arrayIndex;
+ arrayIndex = ParseAndStripArrayIndex(&baseName);
</ins><span class="cx">
</span><del>- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 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->type == GL_FLOAT_VEC2)
</del><ins>+ for (auto locationIt = mOutputVariables.begin(); locationIt != mOutputVariables.end(); locationIt++)
</ins><span class="cx"> {
</span><del>- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
</del><ins>+ const VariableLocation &outputVariable = locationIt->second;
</ins><span class="cx">
</span><del>- for (int i = 0; i < count; i++)
</del><ins>+ if (outputVariable.name == baseName && (arrayIndex == GL_INVALID_INDEX || arrayIndex == outputVariable.element))
</ins><span class="cx"> {
</span><del>- target[0] = v[0];
- target[1] = v[1];
- target[2] = 0;
- target[3] = 0;
- target += 4;
- v += 2;
</del><ins>+ return static_cast<GLint>(locationIt->first);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (targetUniform->type == GL_BOOL_VEC2)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
</del><span class="cx">
</span><del>- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[2] = GL_FALSE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 2;
- }
- }
- else
- {
- return false;
- }
</del><ins>+ return -1;
+}
</ins><span class="cx">
</span><del>- return true;
</del><ins>+size_t ProgramBinary::getTransformFeedbackVaryingCount() const
+{
+ return mTransformFeedbackLinkedVaryings.size();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
</del><ins>+const LinkedVarying &ProgramBinary::getTransformFeedbackVarying(size_t idx) const
</ins><span class="cx"> {
</span><ins>+ return mTransformFeedbackLinkedVaryings[idx];
+}
+
+GLenum ProgramBinary::getTransformFeedbackBufferMode() const
+{
+ return mTransformFeedbackBufferMode;
+}
+
+template <typename T>
+bool ProgramBinary::setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType)
+{
</ins><span class="cx"> if (location < 0 || location >= (int)mUniformIndex.size())
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
</del><ins>+ const int components = UniformComponentCount(targetUniformType);
+ const GLenum targetBoolType = UniformBoolVectorType(targetUniformType);
+
+ LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
</ins><span class="cx"> targetUniform->dirty = true;
</span><span class="cx">
</span><span class="cx"> int elementCount = targetUniform->elementCount();
</span><span class="lines">@@ -374,35 +489,43 @@
</span><span class="cx">
</span><span class="cx"> count = std::min(elementCount - (int)mUniformIndex[location].element, count);
</span><span class="cx">
</span><del>- if (targetUniform->type == GL_FLOAT_VEC3)
</del><ins>+ if (targetUniform->type == targetUniformType)
</ins><span class="cx"> {
</span><del>- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
</del><ins>+ T *target = (T*)targetUniform->data + mUniformIndex[location].element * 4;
</ins><span class="cx">
</span><span class="cx"> for (int i = 0; i < count; i++)
</span><span class="cx"> {
</span><del>- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = 0;
</del><ins>+ for (int c = 0; c < components; c++)
+ {
+ target[c] = v[c];
+ }
+ for (int c = components; c < 4; c++)
+ {
+ target[c] = 0;
+ }
</ins><span class="cx"> target += 4;
</span><del>- v += 3;
</del><ins>+ v += components;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (targetUniform->type == GL_BOOL_VEC3)
</del><ins>+ else if (targetUniform->type == targetBoolType)
</ins><span class="cx"> {
</span><span class="cx"> GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
</span><span class="cx">
</span><span class="cx"> for (int i = 0; i < count; i++)
</span><span class="cx"> {
</span><del>- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[3] = GL_FALSE;
</del><ins>+ for (int c = 0; c < components; c++)
+ {
+ boolParams[c] = (v[c] == static_cast<T>(0)) ? GL_FALSE : GL_TRUE;
+ }
+ for (int c = components; c < 4; c++)
+ {
+ boolParams[c] = GL_FALSE;
+ }
</ins><span class="cx"> boolParams += 4;
</span><del>- v += 3;
</del><ins>+ v += components;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else
</del><ins>+ else
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -410,101 +533,100 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
</del><ins>+bool ProgramBinary::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
</ins><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
</del><ins>+ return setUniform(location, count, v, GL_FLOAT);
+}
</ins><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
</del><ins>+bool ProgramBinary::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ return setUniform(location, count, v, GL_FLOAT_VEC2);
+}
</ins><span class="cx">
</span><del>- int elementCount = targetUniform->elementCount();
</del><ins>+bool ProgramBinary::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ return setUniform(location, count, v, GL_FLOAT_VEC3);
+}
</ins><span class="cx">
</span><del>- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
</del><ins>+bool ProgramBinary::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ return setUniform(location, count, v, GL_FLOAT_VEC4);
+}
</ins><span class="cx">
</span><del>- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
</del><ins>+template<typename T>
+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);
</ins><span class="cx">
</span><del>- if (targetUniform->type == GL_FLOAT_VEC4)
</del><ins>+ for (int x = 0; x < copyWidth; x++)
</ins><span class="cx"> {
</span><del>- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
</del><ins>+ for (int y = 0; y < copyHeight; y++)
</ins><span class="cx"> {
</span><del>- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = v[3];
- target += 4;
- v += 4;
</del><ins>+ target[x * targetWidth + y] = static_cast<T>(value[y * srcWidth + x]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (targetUniform->type == GL_BOOL_VEC4)
</del><ins>+ // clear unfilled right side
+ for (int y = 0; y < copyWidth; y++)
</ins><span class="cx"> {
</span><del>- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
</del><ins>+ for (int x = copyHeight; x < targetWidth; x++)
</ins><span class="cx"> {
</span><del>- boolParams[0] = (v[0] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams[3] = (v[3] == 0.0f) ? GL_FALSE : GL_TRUE;
- boolParams += 4;
- v += 4;
</del><ins>+ target[y * targetWidth + x] = static_cast<T>(0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else
</del><ins>+ // clear unfilled bottom.
+ for (int y = copyWidth; y < targetHeight; y++)
</ins><span class="cx"> {
</span><del>- return false;
</del><ins>+ for (int x = 0; x < targetWidth; x++)
+ {
+ target[y * targetWidth + x] = static_cast<T>(0);
+ }
</ins><span class="cx"> }
</span><del>-
- return true;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-template<typename T, int targetWidth, int targetHeight, int srcWidth, int srcHeight>
-void transposeMatrix(T *target, const GLfloat *value)
</del><ins>+template<typename T>
+void expandMatrix(T *target, const GLfloat *value, int targetWidth, int targetHeight, int srcWidth, int srcHeight)
</ins><span class="cx"> {
</span><span class="cx"> int copyWidth = std::min(targetWidth, srcWidth);
</span><span class="cx"> int copyHeight = std::min(targetHeight, srcHeight);
</span><span class="cx">
</span><del>- for (int x = 0; x < copyWidth; x++)
</del><ins>+ for (int y = 0; y < copyHeight; y++)
</ins><span class="cx"> {
</span><del>- for (int y = 0; y < copyHeight; y++)
</del><ins>+ for (int x = 0; x < copyWidth; x++)
</ins><span class="cx"> {
</span><del>- target[x * targetWidth + y] = (T)value[y * srcWidth + x];
</del><ins>+ target[y * targetWidth + x] = static_cast<T>(value[y * srcWidth + x]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> // clear unfilled right side
</span><span class="cx"> for (int y = 0; y < copyHeight; y++)
</span><span class="cx"> {
</span><del>- for (int x = srcWidth; x < targetWidth; x++)
</del><ins>+ for (int x = copyWidth; x < targetWidth; x++)
</ins><span class="cx"> {
</span><del>- target[y * targetWidth + x] = (T)0;
</del><ins>+ target[y * targetWidth + x] = static_cast<T>(0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> // clear unfilled bottom.
</span><del>- for (int y = srcHeight; y < targetHeight; y++)
</del><ins>+ for (int y = copyHeight; y < targetHeight; y++)
</ins><span class="cx"> {
</span><span class="cx"> for (int x = 0; x < targetWidth; x++)
</span><span class="cx"> {
</span><del>- target[y * targetWidth + x] = (T)0;
</del><ins>+ target[y * targetWidth + x] = static_cast<T>(0);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value)
</del><ins>+template <int cols, int rows>
+bool ProgramBinary::setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType)
</ins><span class="cx"> {
</span><span class="cx"> if (location < 0 || location >= (int)mUniformIndex.size())
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
</del><ins>+ LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
</ins><span class="cx"> targetUniform->dirty = true;
</span><span class="cx">
</span><del>- if (targetUniform->type != GL_FLOAT_MAT2)
</del><ins>+ if (targetUniform->type != targetUniformType)
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -515,83 +637,70 @@
</span><span class="cx"> return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
</span><span class="cx">
</span><span class="cx"> count = std::min(elementCount - (int)mUniformIndex[location].element, count);
</span><del>- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8;
</del><ins>+ const unsigned int targetMatrixStride = (4 * rows);
+ GLfloat *target = (GLfloat*)(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * targetMatrixStride);
</ins><span class="cx">
</span><span class="cx"> for (int i = 0; i < count; i++)
</span><span class="cx"> {
</span><del>- transposeMatrix<GLfloat,4,2,2,2>(target, value);
- target += 8;
- value += 4;
</del><ins>+ // Internally store matrices as transposed versions to accomodate HLSL matrix indexing
+ if (transpose == GL_FALSE)
+ {
+ transposeMatrix<GLfloat>(target, value, 4, rows, rows, cols);
+ }
+ else
+ {
+ expandMatrix<GLfloat>(target, value, 4, rows, cols, rows);
+ }
+ target += targetMatrixStride;
+ value += cols * rows;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value)
</del><ins>+bool ProgramBinary::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
</ins><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
</del><ins>+ return setUniformMatrixfv<2, 2>(location, count, transpose, value, GL_FLOAT_MAT2);
+}
</ins><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
</del><ins>+bool ProgramBinary::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ return setUniformMatrixfv<3, 3>(location, count, transpose, value, GL_FLOAT_MAT3);
+}
</ins><span class="cx">
</span><del>- if (targetUniform->type != GL_FLOAT_MAT3)
- {
- return false;
- }
</del><ins>+bool ProgramBinary::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ return setUniformMatrixfv<4, 4>(location, count, transpose, value, GL_FLOAT_MAT4);
+}
</ins><span class="cx">
</span><del>- int elementCount = targetUniform->elementCount();
</del><ins>+bool ProgramBinary::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ return setUniformMatrixfv<2, 3>(location, count, transpose, value, GL_FLOAT_MAT2x3);
+}
</ins><span class="cx">
</span><del>- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
</del><ins>+bool ProgramBinary::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ return setUniformMatrixfv<3, 2>(location, count, transpose, value, GL_FLOAT_MAT3x2);
+}
</ins><span class="cx">
</span><del>- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
- GLfloat *target = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12;
</del><ins>+bool ProgramBinary::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ return setUniformMatrixfv<2, 4>(location, count, transpose, value, GL_FLOAT_MAT2x4);
+}
</ins><span class="cx">
</span><del>- for (int i = 0; i < count; i++)
- {
- transposeMatrix<GLfloat,4,3,3,3>(target, value);
- target += 12;
- value += 9;
- }
</del><ins>+bool ProgramBinary::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ return setUniformMatrixfv<4, 2>(location, count, transpose, value, GL_FLOAT_MAT4x2);
+}
</ins><span class="cx">
</span><del>- return true;
</del><ins>+bool ProgramBinary::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ return setUniformMatrixfv<3, 4>(location, count, transpose, value, GL_FLOAT_MAT3x4);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-
-bool ProgramBinary::setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value)
</del><ins>+bool ProgramBinary::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
</ins><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- if (targetUniform->type != GL_FLOAT_MAT4)
- {
- return false;
- }
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 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);
- GLfloat *target = (GLfloat*)(targetUniform->data + mUniformIndex[location].element * sizeof(GLfloat) * 16);
-
- for (int i = 0; i < count; i++)
- {
- transposeMatrix<GLfloat,4,4,4,4>(target, value);
- target += 16;
- value += 16;
- }
-
- return true;
</del><ins>+ return setUniformMatrixfv<4, 3>(location, count, transpose, value, GL_FLOAT_MAT4x3);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ProgramBinary::setUniform1iv(GLint location, GLsizei count, const GLint *v)
</span><span class="lines">@@ -601,7 +710,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
</del><ins>+ LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
</ins><span class="cx"> targetUniform->dirty = true;
</span><span class="cx">
</span><span class="cx"> int elementCount = targetUniform->elementCount();
</span><span class="lines">@@ -611,9 +720,7 @@
</span><span class="cx">
</span><span class="cx"> count = std::min(elementCount - (int)mUniformIndex[location].element, count);
</span><span class="cx">
</span><del>- if (targetUniform->type == GL_INT ||
- targetUniform->type == GL_SAMPLER_2D ||
- targetUniform->type == GL_SAMPLER_CUBE)
</del><ins>+ if (targetUniform->type == GL_INT || IsSampler(targetUniform->type))
</ins><span class="cx"> {
</span><span class="cx"> GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
</span><span class="cx">
</span><span class="lines">@@ -651,171 +758,48 @@
</span><span class="cx">
</span><span class="cx"> bool ProgramBinary::setUniform2iv(GLint location, GLsizei count, const GLint *v)
</span><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 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->type == GL_INT_VEC2)
- {
- GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- target[0] = v[0];
- target[1] = v[1];
- target[2] = 0;
- target[3] = 0;
- target += 4;
- v += 2;
- }
- }
- else if (targetUniform->type == GL_BOOL_VEC2)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[2] = GL_FALSE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 2;
- }
- }
- else
- {
- return false;
- }
-
- return true;
</del><ins>+ return setUniform(location, count, v, GL_INT_VEC2);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ProgramBinary::setUniform3iv(GLint location, GLsizei count, const GLint *v)
</span><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
-
- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
-
- int elementCount = targetUniform->elementCount();
-
- if (elementCount == 1 && count > 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->type == GL_INT_VEC3)
- {
- GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = 0;
- target += 4;
- v += 3;
- }
- }
- else if (targetUniform->type == GL_BOOL_VEC3)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[3] = GL_FALSE;
- boolParams += 4;
- v += 3;
- }
- }
- else
- {
- return false;
- }
-
- return true;
</del><ins>+ return setUniform(location, count, v, GL_INT_VEC3);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ProgramBinary::setUniform4iv(GLint location, GLsizei count, const GLint *v)
</span><span class="cx"> {
</span><del>- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
</del><ins>+ return setUniform(location, count, v, GL_INT_VEC4);
+}
</ins><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
- targetUniform->dirty = true;
</del><ins>+bool ProgramBinary::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ return setUniform(location, count, v, GL_UNSIGNED_INT);
+}
</ins><span class="cx">
</span><del>- int elementCount = targetUniform->elementCount();
</del><ins>+bool ProgramBinary::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ return setUniform(location, count, v, GL_UNSIGNED_INT_VEC2);
+}
</ins><span class="cx">
</span><del>- if (elementCount == 1 && count > 1)
- return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
</del><ins>+bool ProgramBinary::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ return setUniform(location, count, v, GL_UNSIGNED_INT_VEC3);
+}
</ins><span class="cx">
</span><del>- count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-
- if (targetUniform->type == GL_INT_VEC4)
- {
- GLint *target = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- target[0] = v[0];
- target[1] = v[1];
- target[2] = v[2];
- target[3] = v[3];
- target += 4;
- v += 4;
- }
- }
- else if (targetUniform->type == GL_BOOL_VEC4)
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (int i = 0; i < count; i++)
- {
- boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[1] = (v[1] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[2] = (v[2] == 0) ? GL_FALSE : GL_TRUE;
- boolParams[3] = (v[3] == 0) ? GL_FALSE : GL_TRUE;
- boolParams += 4;
- v += 4;
- }
- }
- else
- {
- return false;
- }
-
- return true;
</del><ins>+bool ProgramBinary::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ return setUniform(location, count, v, GL_UNSIGNED_INT_VEC4);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params)
</del><ins>+template <typename T>
+bool ProgramBinary::getUniformv(GLint location, GLsizei *bufSize, T *params, GLenum uniformType)
</ins><span class="cx"> {
</span><span class="cx"> if (location < 0 || location >= (int)mUniformIndex.size())
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
</del><ins>+ LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
</ins><span class="cx">
</span><span class="cx"> // sized queries -- ensure the provided buffer is large enough
</span><span class="cx"> if (bufSize)
</span><span class="lines">@@ -827,123 +811,89 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- switch (targetUniform->type)
</del><ins>+ if (IsMatrixType(targetUniform->type))
</ins><span class="cx"> {
</span><del>- case GL_FLOAT_MAT2:
- transposeMatrix<GLfloat,2,2,4,2>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8);
- break;
- case GL_FLOAT_MAT3:
- transposeMatrix<GLfloat,3,3,4,3>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12);
- break;
- case GL_FLOAT_MAT4:
- transposeMatrix<GLfloat,4,4,4,4>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16);
- break;
- default:
</del><ins>+ const int rows = VariableRowCount(targetUniform->type);
+ const int cols = VariableColumnCount(targetUniform->type);
+ transposeMatrix(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4 * rows, rows, cols, 4, rows);
+ }
+ else if (uniformType == UniformComponentType(targetUniform->type))
+ {
+ unsigned int size = UniformComponentCount(targetUniform->type);
+ memcpy(params, targetUniform->data + mUniformIndex[location].element * 4 * sizeof(T),
+ size * sizeof(T));
+ }
+ else
+ {
+ unsigned int size = UniformComponentCount(targetUniform->type);
+ switch (UniformComponentType(targetUniform->type))
</ins><span class="cx"> {
</span><del>- unsigned int size = UniformComponentCount(targetUniform->type);
-
- switch (UniformComponentType(targetUniform->type))
</del><ins>+ case GL_BOOL:
</ins><span class="cx"> {
</span><del>- case GL_BOOL:
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
</del><ins>+ GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
</ins><span class="cx">
</span><del>- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = (boolParams[i] == GL_FALSE) ? 0.0f : 1.0f;
- }
- }
- break;
- case GL_FLOAT:
- memcpy(params, targetUniform->data + mUniformIndex[location].element * 4 * sizeof(GLfloat),
- size * sizeof(GLfloat));
- break;
- case GL_INT:
</del><ins>+ for (unsigned int i = 0; i < size; i++)
</ins><span class="cx"> {
</span><del>- GLint *intParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = (float)intParams[i];
- }
</del><ins>+ params[i] = (boolParams[i] == GL_FALSE) ? static_cast<T>(0) : static_cast<T>(1);
</ins><span class="cx"> }
</span><del>- break;
- default: UNREACHABLE();
</del><span class="cx"> }
</span><del>- }
- }
</del><ins>+ break;
</ins><span class="cx">
</span><del>- return true;
-}
</del><ins>+ case GL_FLOAT:
+ {
+ GLfloat *floatParams = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
</ins><span class="cx">
</span><del>-bool ProgramBinary::getUniformiv(GLint location, GLsizei *bufSize, GLint *params)
-{
- if (location < 0 || location >= (int)mUniformIndex.size())
- {
- return false;
- }
</del><ins>+ for (unsigned int i = 0; i < size; i++)
+ {
+ params[i] = static_cast<T>(floatParams[i]);
+ }
+ }
+ break;
</ins><span class="cx">
</span><del>- Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
</del><ins>+ case GL_INT:
+ {
+ GLint *intParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
</ins><span class="cx">
</span><del>- // sized queries -- ensure the provided buffer is large enough
- if (bufSize)
- {
- int requiredBytes = UniformExternalSize(targetUniform->type);
- if (*bufSize < requiredBytes)
- {
- return false;
- }
- }
-
- switch (targetUniform->type)
- {
- case GL_FLOAT_MAT2:
- transposeMatrix<GLint,2,2,4,2>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8);
- break;
- case GL_FLOAT_MAT3:
- transposeMatrix<GLint,3,3,4,3>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12);
- break;
- case GL_FLOAT_MAT4:
- transposeMatrix<GLint,4,4,4,4>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16);
- break;
- default:
- {
- unsigned int size = VariableColumnCount(targetUniform->type);
-
- switch (UniformComponentType(targetUniform->type))
</del><ins>+ for (unsigned int i = 0; i < size; i++)
+ {
+ params[i] = static_cast<T>(intParams[i]);
+ }
+ }
+ break;
+
+ case GL_UNSIGNED_INT:
</ins><span class="cx"> {
</span><del>- case GL_BOOL:
- {
- GLint *boolParams = (GLint*)targetUniform->data + mUniformIndex[location].element * 4;
</del><ins>+ GLuint *uintParams = (GLuint*)targetUniform->data + mUniformIndex[location].element * 4;
</ins><span class="cx">
</span><del>- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = boolParams[i];
- }
- }
- break;
- case GL_FLOAT:
</del><ins>+ for (unsigned int i = 0; i < size; i++)
</ins><span class="cx"> {
</span><del>- GLfloat *floatParams = (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4;
-
- for (unsigned int i = 0; i < size; i++)
- {
- params[i] = (GLint)floatParams[i];
- }
</del><ins>+ params[i] = static_cast<T>(uintParams[i]);
</ins><span class="cx"> }
</span><del>- break;
- case GL_INT:
- memcpy(params, targetUniform->data + mUniformIndex[location].element * 4 * sizeof(GLint),
- size * sizeof(GLint));
- break;
- default: UNREACHABLE();
</del><span class="cx"> }
</span><ins>+ break;
+
+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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);
+}
+
</ins><span class="cx"> void ProgramBinary::dirtyAllUniforms()
</span><span class="cx"> {
</span><span class="cx"> unsigned int numUniforms = mUniforms.size();
</span><span class="lines">@@ -957,19 +907,18 @@
</span><span class="cx"> void ProgramBinary::applyUniforms()
</span><span class="cx"> {
</span><span class="cx"> // Retrieve sampler uniform values
</span><del>- for (std::vector<Uniform*>::iterator ub = mUniforms.begin(), ue = mUniforms.end(); ub != ue; ++ub)
</del><ins>+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++)
</ins><span class="cx"> {
</span><del>- Uniform *targetUniform = *ub;
</del><ins>+ LinkedUniform *targetUniform = mUniforms[uniformIndex];
</ins><span class="cx">
</span><span class="cx"> if (targetUniform->dirty)
</span><span class="cx"> {
</span><del>- if (targetUniform->type == GL_SAMPLER_2D ||
- targetUniform->type == GL_SAMPLER_CUBE)
</del><ins>+ if (IsSampler(targetUniform->type))
</ins><span class="cx"> {
</span><span class="cx"> int count = targetUniform->elementCount();
</span><span class="cx"> GLint (*v)[4] = (GLint(*)[4])targetUniform->data;
</span><span class="cx">
</span><del>- if (targetUniform->psRegisterIndex >= 0)
</del><ins>+ if (targetUniform->isReferencedByFragmentShader())
</ins><span class="cx"> {
</span><span class="cx"> unsigned int firstIndex = targetUniform->psRegisterIndex;
</span><span class="cx">
</span><span class="lines">@@ -985,7 +934,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (targetUniform->vsRegisterIndex >= 0)
</del><ins>+ if (targetUniform->isReferencedByVertexShader())
</ins><span class="cx"> {
</span><span class="cx"> unsigned int firstIndex = targetUniform->vsRegisterIndex;
</span><span class="cx">
</span><span class="lines">@@ -1004,214 +953,81 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mRenderer->applyUniforms(this, &mUniforms);
</del><ins>+ mRenderer->applyUniforms(*this);
+
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++)
+ {
+ mUniforms[uniformIndex]->dirty = false;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
-// Returns the number of used varying registers, or -1 if unsuccesful
-int ProgramBinary::packVaryings(InfoLog &infoLog, const Varying *packing[][4], FragmentShader *fragmentShader)
</del><ins>+bool ProgramBinary::applyUniformBuffers(const std::vector<gl::Buffer*> boundBuffers)
</ins><span class="cx"> {
</span><del>- const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
</del><ins>+ const gl::Buffer *vertexUniformBuffers[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS] = {NULL};
+ const gl::Buffer *fragmentUniformBuffers[gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS] = {NULL};
</ins><span class="cx">
</span><del>- fragmentShader->resetVaryingsRegisterAssignment();
</del><ins>+ const unsigned int reservedBuffersInVS = mRenderer->getReservedVertexUniformBuffers();
+ const unsigned int reservedBuffersInFS = mRenderer->getReservedFragmentUniformBuffers();
</ins><span class="cx">
</span><del>- for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
</del><ins>+ ASSERT(boundBuffers.size() == mUniformBlocks.size());
+
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < mUniformBlocks.size(); uniformBlockIndex++)
</ins><span class="cx"> {
</span><del>- int n = VariableRowCount(varying->type) * varying->size;
- int m = VariableColumnCount(varying->type);
- bool success = false;
</del><ins>+ gl::UniformBlock *uniformBlock = getUniformBlockByIndex(uniformBlockIndex);
+ gl::Buffer *uniformBuffer = boundBuffers[uniformBlockIndex];
</ins><span class="cx">
</span><del>- if (m == 2 || m == 3 || m == 4)
</del><ins>+ ASSERT(uniformBlock && uniformBuffer);
+
+ if (uniformBuffer->size() < uniformBlock->dataSize)
</ins><span class="cx"> {
</span><del>- for (int r = 0; r <= maxVaryingVectors - n && !success; r++)
- {
- bool available = true;
-
- for (int y = 0; y < n && available; y++)
- {
- for (int x = 0; x < m && available; x++)
- {
- if (packing[r + y][x])
- {
- available = false;
- }
- }
- }
-
- if (available)
- {
- varying->reg = r;
- varying->col = 0;
-
- for (int y = 0; y < n; y++)
- {
- for (int x = 0; x < m; x++)
- {
- packing[r + y][x] = &*varying;
- }
- }
-
- success = true;
- }
- }
-
- if (!success && m == 2)
- {
- for (int r = maxVaryingVectors - n; r >= 0 && !success; r--)
- {
- bool available = true;
-
- for (int y = 0; y < n && available; y++)
- {
- for (int x = 2; x < 4 && available; x++)
- {
- if (packing[r + y][x])
- {
- available = false;
- }
- }
- }
-
- if (available)
- {
- varying->reg = r;
- varying->col = 2;
-
- for (int y = 0; y < n; y++)
- {
- for (int x = 2; x < 4; x++)
- {
- packing[r + y][x] = &*varying;
- }
- }
-
- success = true;
- }
- }
- }
</del><ins>+ // undefined behaviour
+ return false;
</ins><span class="cx"> }
</span><del>- else if (m == 1)
- {
- int space[4] = {0};
</del><span class="cx">
</span><del>- for (int y = 0; y < maxVaryingVectors; y++)
- {
- for (int x = 0; x < 4; x++)
- {
- space[x] += packing[y][x] ? 0 : 1;
- }
- }
</del><ins>+ ASSERT(uniformBlock->isReferencedByVertexShader() || uniformBlock->isReferencedByFragmentShader());
</ins><span class="cx">
</span><del>- int column = 0;
-
- for (int x = 0; x < 4; x++)
- {
- if (space[x] >= n && space[x] < space[column])
- {
- column = x;
- }
- }
-
- if (space[column] >= n)
- {
- for (int r = 0; r < maxVaryingVectors; r++)
- {
- if (!packing[r][column])
- {
- varying->reg = r;
-
- for (int y = r; y < r + n; y++)
- {
- packing[y][column] = &*varying;
- }
-
- break;
- }
- }
-
- varying->col = column;
-
- success = true;
- }
- }
- else UNREACHABLE();
-
- if (!success)
</del><ins>+ if (uniformBlock->isReferencedByVertexShader())
</ins><span class="cx"> {
</span><del>- infoLog.append("Could not pack varying %s", varying->name.c_str());
-
- return -1;
</del><ins>+ unsigned int registerIndex = uniformBlock->vsRegisterIndex - reservedBuffersInVS;
+ ASSERT(vertexUniformBuffers[registerIndex] == NULL);
+ ASSERT(registerIndex < mRenderer->getMaxVertexShaderUniformBuffers());
+ vertexUniformBuffers[registerIndex] = uniformBuffer;
</ins><span class="cx"> }
</span><del>- }
</del><span class="cx">
</span><del>- // Return the number of used registers
- int registers = 0;
-
- for (int r = 0; r < maxVaryingVectors; r++)
- {
- if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
</del><ins>+ if (uniformBlock->isReferencedByFragmentShader())
</ins><span class="cx"> {
</span><del>- registers++;
</del><ins>+ unsigned int registerIndex = uniformBlock->psRegisterIndex - reservedBuffersInFS;
+ ASSERT(fragmentUniformBuffers[registerIndex] == NULL);
+ ASSERT(registerIndex < mRenderer->getMaxFragmentShaderUniformBuffers());
+ fragmentUniformBuffers[registerIndex] = uniformBuffer;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return registers;
</del><ins>+ return mRenderer->setUniformBuffers(vertexUniformBuffers, fragmentUniformBuffers);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::linkVaryings(InfoLog &infoLog, int registers, const Varying *packing[][4],
- std::string& pixelHLSL, std::string& vertexHLSL,
- FragmentShader *fragmentShader, VertexShader *vertexShader)
</del><ins>+bool ProgramBinary::linkVaryings(InfoLog &infoLog, FragmentShader *fragmentShader, VertexShader *vertexShader)
</ins><span class="cx"> {
</span><del>- if (pixelHLSL.empty() || vertexHLSL.empty())
- {
- return false;
- }
</del><ins>+ std::vector<gl::Varying> &fragmentVaryings = fragmentShader->getVaryings();
+ std::vector<gl::Varying> &vertexVaryings = vertexShader->getVaryings();
</ins><span class="cx">
</span><del>- bool usesMRT = fragmentShader->mUsesMultipleRenderTargets;
- bool usesFragColor = fragmentShader->mUsesFragColor;
- bool usesFragData = fragmentShader->mUsesFragData;
- if (usesFragColor && usesFragData)
</del><ins>+ for (size_t fragVaryingIndex = 0; fragVaryingIndex < fragmentVaryings.size(); fragVaryingIndex++)
</ins><span class="cx"> {
</span><del>- infoLog.append("Cannot use both gl_FragColor and gl_FragData in the same fragment shader.");
- return false;
- }
-
- // Write the HLSL input/output declarations
- const int shaderModel = mRenderer->getMajorShaderModel();
- const int maxVaryingVectors = mRenderer->getMaxVaryingVectors();
-
- const int registersNeeded = registers + (fragmentShader->mUsesFragCoord ? 1 : 0) + (fragmentShader->mUsesPointCoord ? 1 : 0);
-
- // The output color is broadcast to all enabled draw buffers when writing to gl_FragColor
- const bool broadcast = fragmentShader->mUsesFragColor;
- const unsigned int numRenderTargets = (broadcast || usesMRT ? mRenderer->getMaxRenderTargets() : 1);
-
- if (registersNeeded > maxVaryingVectors)
- {
- infoLog.append("No varying registers left to support gl_FragCoord/gl_PointCoord");
-
- return false;
- }
-
- vertexShader->resetVaryingsRegisterAssignment();
-
- for (VaryingList::iterator input = fragmentShader->mVaryings.begin(); input != fragmentShader->mVaryings.end(); input++)
- {
</del><ins>+ gl::Varying *input = &fragmentVaryings[fragVaryingIndex];
</ins><span class="cx"> bool matched = false;
</span><span class="cx">
</span><del>- for (VaryingList::iterator output = vertexShader->mVaryings.begin(); output != vertexShader->mVaryings.end(); output++)
</del><ins>+ for (size_t vertVaryingIndex = 0; vertVaryingIndex < vertexVaryings.size(); vertVaryingIndex++)
</ins><span class="cx"> {
</span><ins>+ gl::Varying *output = &vertexVaryings[vertVaryingIndex];
</ins><span class="cx"> if (output->name == input->name)
</span><span class="cx"> {
</span><del>- if (output->type != input->type || output->size != input->size)
</del><ins>+ if (!linkValidateVariables(infoLog, output->name, *input, *output))
</ins><span class="cx"> {
</span><del>- infoLog.append("Type of vertex varying %s does not match that of the fragment varying", output->name.c_str());
-
</del><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- output->reg = input->reg;
- output->col = input->col;
</del><ins>+ output->registerIndex = input->registerIndex;
+ output->elementIndex = input->elementIndex;
</ins><span class="cx">
</span><span class="cx"> matched = true;
</span><span class="cx"> break;
</span><span class="lines">@@ -1221,397 +1037,10 @@
</span><span class="cx"> if (!matched)
</span><span class="cx"> {
</span><span class="cx"> infoLog.append("Fragment varying %s does not match any vertex varying", input->name.c_str());
</span><del>-
</del><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mUsesPointSize = vertexShader->mUsesPointSize;
- std::string varyingSemantic = (mUsesPointSize && shaderModel == 3) ? "COLOR" : "TEXCOORD";
- std::string targetSemantic = (shaderModel >= 4) ? "SV_Target" : "COLOR";
- std::string positionSemantic = (shaderModel >= 4) ? "SV_Position" : "POSITION";
- std::string depthSemantic = (shaderModel >= 4) ? "SV_Depth" : "DEPTH";
-
- // special varyings that use reserved registers
- int reservedRegisterIndex = registers;
- std::string fragCoordSemantic;
- std::string pointCoordSemantic;
-
- if (fragmentShader->mUsesFragCoord)
- {
- fragCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
- }
-
- if (fragmentShader->mUsesPointCoord)
- {
- // Shader model 3 uses a special TEXCOORD semantic for point sprite texcoords.
- // In DX11 we compute this in the GS.
- if (shaderModel == 3)
- {
- pointCoordSemantic = "TEXCOORD0";
- }
- else if (shaderModel >= 4)
- {
- pointCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
- }
- }
-
- vertexHLSL += "struct VS_INPUT\n"
- "{\n";
-
- int semanticIndex = 0;
- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
- {
- switch (attribute->type)
- {
- case GL_FLOAT: vertexHLSL += " float "; break;
- case GL_FLOAT_VEC2: vertexHLSL += " float2 "; break;
- case GL_FLOAT_VEC3: vertexHLSL += " float3 "; break;
- case GL_FLOAT_VEC4: vertexHLSL += " float4 "; break;
- case GL_FLOAT_MAT2: vertexHLSL += " float2x2 "; break;
- case GL_FLOAT_MAT3: vertexHLSL += " float3x3 "; break;
- case GL_FLOAT_MAT4: vertexHLSL += " float4x4 "; break;
- default: UNREACHABLE();
- }
-
- vertexHLSL += decorateAttribute(attribute->name) + " : TEXCOORD" + str(semanticIndex) + ";\n";
-
- semanticIndex += VariableRowCount(attribute->type);
- }
-
- vertexHLSL += "};\n"
- "\n"
- "struct VS_OUTPUT\n"
- "{\n";
-
- if (shaderModel < 4)
- {
- vertexHLSL += " float4 gl_Position : " + positionSemantic + ";\n";
- }
-
- for (int r = 0; r < registers; r++)
- {
- int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
-
- vertexHLSL += " float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
- }
-
- if (fragmentShader->mUsesFragCoord)
- {
- vertexHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
- }
-
- if (vertexShader->mUsesPointSize && shaderModel >= 3)
- {
- vertexHLSL += " float gl_PointSize : PSIZE;\n";
- }
-
- if (shaderModel >= 4)
- {
- vertexHLSL += " float4 gl_Position : " + positionSemantic + ";\n";
- }
-
- vertexHLSL += "};\n"
- "\n"
- "VS_OUTPUT main(VS_INPUT input)\n"
- "{\n";
-
- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
- {
- vertexHLSL += " " + decorateAttribute(attribute->name) + " = ";
-
- if (VariableRowCount(attribute->type) > 1) // Matrix
- {
- vertexHLSL += "transpose";
- }
-
- vertexHLSL += "(input." + decorateAttribute(attribute->name) + ");\n";
- }
-
- if (shaderModel >= 4)
- {
- vertexHLSL += "\n"
- " gl_main();\n"
- "\n"
- " VS_OUTPUT output;\n"
- " output.gl_Position.x = gl_Position.x;\n"
- " output.gl_Position.y = -gl_Position.y;\n"
- " output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
- " output.gl_Position.w = gl_Position.w;\n";
- }
- else
- {
- vertexHLSL += "\n"
- " gl_main();\n"
- "\n"
- " VS_OUTPUT output;\n"
- " output.gl_Position.x = gl_Position.x * dx_ViewAdjust.z + dx_ViewAdjust.x * gl_Position.w;\n"
- " output.gl_Position.y = -(gl_Position.y * dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n"
- " output.gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
- " output.gl_Position.w = gl_Position.w;\n";
- }
-
- if (vertexShader->mUsesPointSize && shaderModel >= 3)
- {
- vertexHLSL += " output.gl_PointSize = gl_PointSize;\n";
- }
-
- if (fragmentShader->mUsesFragCoord)
- {
- vertexHLSL += " output.gl_FragCoord = gl_Position;\n";
- }
-
- for (VaryingList::iterator varying = vertexShader->mVaryings.begin(); varying != vertexShader->mVaryings.end(); varying++)
- {
- if (varying->reg >= 0)
- {
- for (int i = 0; i < varying->size; i++)
- {
- int rows = VariableRowCount(varying->type);
-
- for (int j = 0; j < rows; j++)
- {
- int r = varying->reg + i * rows + j;
- vertexHLSL += " output.v" + str(r);
-
- bool sharedRegister = false; // Register used by multiple varyings
-
- for (int x = 0; x < 4; x++)
- {
- if (packing[r][x] && packing[r][x] != packing[r][0])
- {
- sharedRegister = true;
- break;
- }
- }
-
- if(sharedRegister)
- {
- vertexHLSL += ".";
-
- for (int x = 0; x < 4; x++)
- {
- if (packing[r][x] == &*varying)
- {
- switch(x)
- {
- case 0: vertexHLSL += "x"; break;
- case 1: vertexHLSL += "y"; break;
- case 2: vertexHLSL += "z"; break;
- case 3: vertexHLSL += "w"; break;
- }
- }
- }
- }
-
- vertexHLSL += " = " + varying->name;
-
- if (varying->array)
- {
- vertexHLSL += "[" + str(i) + "]";
- }
-
- if (rows > 1)
- {
- vertexHLSL += "[" + str(j) + "]";
- }
-
- vertexHLSL += ";\n";
- }
- }
- }
- }
-
- vertexHLSL += "\n"
- " return output;\n"
- "}\n";
-
- pixelHLSL += "struct PS_INPUT\n"
- "{\n";
-
- for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
- {
- if (varying->reg >= 0)
- {
- for (int i = 0; i < varying->size; i++)
- {
- int rows = VariableRowCount(varying->type);
- for (int j = 0; j < rows; j++)
- {
- std::string n = str(varying->reg + i * rows + j);
- pixelHLSL += " float" + str(VariableColumnCount(varying->type)) + " v" + n + " : " + varyingSemantic + n + ";\n";
- }
- }
- }
- else UNREACHABLE();
- }
-
- if (fragmentShader->mUsesFragCoord)
- {
- pixelHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
- }
-
- if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
- {
- pixelHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + ";\n";
- }
-
- // 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->mUsesPointSize && shaderModel >= 4)
- {
- pixelHLSL += " float gl_PointSize : PSIZE;\n";
- }
-
- if (fragmentShader->mUsesFragCoord)
- {
- if (shaderModel >= 4)
- {
- pixelHLSL += " float4 dx_VPos : SV_Position;\n";
- }
- else if (shaderModel >= 3)
- {
- pixelHLSL += " float2 dx_VPos : VPOS;\n";
- }
- }
-
- pixelHLSL += "};\n"
- "\n"
- "struct PS_OUTPUT\n"
- "{\n";
-
- for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
- {
- pixelHLSL += " float4 gl_Color" + str(renderTargetIndex) + " : " + targetSemantic + str(renderTargetIndex) + ";\n";
- }
-
- if (fragmentShader->mUsesFragDepth)
- {
- pixelHLSL += " float gl_Depth : " + depthSemantic + ";\n";
- }
-
- pixelHLSL += "};\n"
- "\n";
-
- if (fragmentShader->mUsesFrontFacing)
- {
- if (shaderModel >= 4)
- {
- pixelHLSL += "PS_OUTPUT main(PS_INPUT input, bool isFrontFace : SV_IsFrontFace)\n"
- "{\n";
- }
- else
- {
- pixelHLSL += "PS_OUTPUT main(PS_INPUT input, float vFace : VFACE)\n"
- "{\n";
- }
- }
- else
- {
- pixelHLSL += "PS_OUTPUT main(PS_INPUT input)\n"
- "{\n";
- }
-
- if (fragmentShader->mUsesFragCoord)
- {
- pixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
-
- if (shaderModel >= 4)
- {
- pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x;\n"
- " gl_FragCoord.y = input.dx_VPos.y;\n";
- }
- else if (shaderModel >= 3)
- {
- pixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
- " gl_FragCoord.y = input.dx_VPos.y + 0.5;\n";
- }
- else
- {
- // dx_ViewCoords contains the viewport width/2, height/2, center.x and center.y. See Renderer::setViewport()
- pixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_ViewCoords.x + dx_ViewCoords.z;\n"
- " gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_ViewCoords.y + dx_ViewCoords.w;\n";
- }
-
- pixelHLSL += " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_DepthFront.x + dx_DepthFront.y;\n"
- " gl_FragCoord.w = rhw;\n";
- }
-
- if (fragmentShader->mUsesPointCoord && shaderModel >= 3)
- {
- pixelHLSL += " gl_PointCoord.x = input.gl_PointCoord.x;\n";
- pixelHLSL += " gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n";
- }
-
- if (fragmentShader->mUsesFrontFacing)
- {
- if (shaderModel <= 3)
- {
- pixelHLSL += " gl_FrontFacing = (vFace * dx_DepthFront.z >= 0.0);\n";
- }
- else
- {
- pixelHLSL += " gl_FrontFacing = isFrontFace;\n";
- }
- }
-
- for (VaryingList::iterator varying = fragmentShader->mVaryings.begin(); varying != fragmentShader->mVaryings.end(); varying++)
- {
- if (varying->reg >= 0)
- {
- for (int i = 0; i < varying->size; i++)
- {
- int rows = VariableRowCount(varying->type);
- for (int j = 0; j < rows; j++)
- {
- std::string n = str(varying->reg + i * rows + j);
- pixelHLSL += " " + varying->name;
-
- if (varying->array)
- {
- pixelHLSL += "[" + str(i) + "]";
- }
-
- if (rows > 1)
- {
- pixelHLSL += "[" + str(j) + "]";
- }
-
- switch (VariableColumnCount(varying->type))
- {
- case 1: pixelHLSL += " = input.v" + n + ".x;\n"; break;
- case 2: pixelHLSL += " = input.v" + n + ".xy;\n"; break;
- case 3: pixelHLSL += " = input.v" + n + ".xyz;\n"; break;
- case 4: pixelHLSL += " = input.v" + n + ";\n"; break;
- default: UNREACHABLE();
- }
- }
- }
- }
- else UNREACHABLE();
- }
-
- pixelHLSL += "\n"
- " gl_main();\n"
- "\n"
- " PS_OUTPUT output;\n";
-
- for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets; renderTargetIndex++)
- {
- unsigned int sourceColorIndex = broadcast ? 0 : renderTargetIndex;
-
- pixelHLSL += " output.gl_Color" + str(renderTargetIndex) + " = gl_Color[" + str(sourceColorIndex) + "];\n";
- }
-
- if (fragmentShader->mUsesFragDepth)
- {
- pixelHLSL += " output.gl_Depth = gl_Depth;\n";
- }
-
- pixelHLSL += "\n"
- " return output;\n"
- "}\n";
-
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1659,6 +1088,8 @@
</span><span class="cx"> std::string name;
</span><span class="cx"> stream.read(&name);
</span><span class="cx"> mLinkedAttribute[i].name = name;
</span><ins>+ stream.read(&mShaderAttributes[i].type);
+ stream.read(&mShaderAttributes[i].name);
</ins><span class="cx"> stream.read(&mSemanticIndex[i]);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1687,6 +1118,7 @@
</span><span class="cx"> stream.read(&mUsedVertexSamplerRange);
</span><span class="cx"> stream.read(&mUsedPixelSamplerRange);
</span><span class="cx"> stream.read(&mUsesPointSize);
</span><ins>+ stream.read(&mShaderVersion);
</ins><span class="cx">
</span><span class="cx"> size_t size;
</span><span class="cx"> stream.read(&size);
</span><span class="lines">@@ -1703,17 +1135,32 @@
</span><span class="cx"> GLenum precision;
</span><span class="cx"> std::string name;
</span><span class="cx"> unsigned int arraySize;
</span><ins>+ int blockIndex;
</ins><span class="cx">
</span><span class="cx"> stream.read(&type);
</span><span class="cx"> stream.read(&precision);
</span><span class="cx"> stream.read(&name);
</span><span class="cx"> stream.read(&arraySize);
</span><ins>+ stream.read(&blockIndex);
</ins><span class="cx">
</span><del>- mUniforms[i] = new Uniform(type, precision, name, arraySize);
</del><ins>+ int offset;
+ int arrayStride;
+ int matrixStride;
+ bool isRowMajorMatrix;
+
+ stream.read(&offset);
+ stream.read(&arrayStride);
+ stream.read(&matrixStride);
+ stream.read(&isRowMajorMatrix);
+
+ const gl::BlockMemberInfo blockInfo(offset, arrayStride, matrixStride, isRowMajorMatrix);
+
+ mUniforms[i] = new LinkedUniform(type, precision, name, arraySize, blockIndex, blockInfo);
</ins><span class="cx">
</span><span class="cx"> stream.read(&mUniforms[i]->psRegisterIndex);
</span><span class="cx"> stream.read(&mUniforms[i]->vsRegisterIndex);
</span><span class="cx"> stream.read(&mUniforms[i]->registerCount);
</span><ins>+ stream.read(&mUniforms[i]->registerElement);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> stream.read(&size);
</span><span class="lines">@@ -1723,6 +1170,39 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ mUniformBlocks.resize(size);
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < size; ++uniformBlockIndex)
+ {
+ std::string name;
+ unsigned int elementIndex;
+ unsigned int dataSize;
+
+ stream.read(&name);
+ stream.read(&elementIndex);
+ stream.read(&dataSize);
+
+ mUniformBlocks[uniformBlockIndex] = new UniformBlock(name, elementIndex, dataSize);
+
+ UniformBlock& uniformBlock = *mUniformBlocks[uniformBlockIndex];
+ stream.read(&uniformBlock.psRegisterIndex);
+ stream.read(&uniformBlock.vsRegisterIndex);
+
+ size_t numMembers;
+ stream.read(&numMembers);
+ uniformBlock.memberUniformIndexes.resize(numMembers);
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < numMembers; blockMemberIndex++)
+ {
+ stream.read(&uniformBlock.memberUniformIndexes[blockMemberIndex]);
+ }
+ }
+
+ stream.read(&size);
+ if (stream.error())
+ {
+ infoLog.append("Invalid program binary.");
+ return false;
+ }
+
</ins><span class="cx"> mUniformIndex.resize(size);
</span><span class="cx"> for (unsigned int i = 0; i < size; ++i)
</span><span class="cx"> {
</span><span class="lines">@@ -1731,73 +1211,106 @@
</span><span class="cx"> stream.read(&mUniformIndex[i].index);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned int pixelShaderSize;
- stream.read(&pixelShaderSize);
</del><ins>+ stream.read(&mTransformFeedbackBufferMode);
+ stream.read(&size);
+ mTransformFeedbackLinkedVaryings.resize(size);
+ for (size_t i = 0; i < mTransformFeedbackLinkedVaryings.size(); i++)
+ {
+ LinkedVarying &varying = mTransformFeedbackLinkedVaryings[i];
</ins><span class="cx">
</span><del>- unsigned int vertexShaderSize;
- stream.read(&vertexShaderSize);
</del><ins>+ stream.read(&varying.name);
+ stream.read(&varying.type);
+ stream.read(&varying.size);
+ stream.read(&varying.semanticName);
+ stream.read(&varying.semanticIndex);
+ stream.read(&varying.semanticIndexCount);
+ }
</ins><span class="cx">
</span><del>- unsigned int geometryShaderSize;
- stream.read(&geometryShaderSize);
</del><ins>+ stream.read(&mVertexHLSL);
+ stream.read(&mVertexWorkarounds);
</ins><span class="cx">
</span><del>- const char *ptr = (const char*) binary + stream.offset();
</del><ins>+ unsigned int vertexShaderCount;
+ stream.read(&vertexShaderCount);
</ins><span class="cx">
</span><del>- const GUID *binaryIdentifier = (const GUID *) ptr;
- ptr += sizeof(GUID);
-
- GUID identifier = mRenderer->getAdapterIdentifier();
- if (memcmp(&identifier, binaryIdentifier, sizeof(GUID)) != 0)
</del><ins>+ for (unsigned int vertexShaderIndex = 0; vertexShaderIndex < vertexShaderCount; vertexShaderIndex++)
</ins><span class="cx"> {
</span><del>- infoLog.append("Invalid program binary.");
- return false;
- }
</del><ins>+ VertexFormat vertexInputs[gl::MAX_VERTEX_ATTRIBS];
</ins><span class="cx">
</span><del>- const char *pixelShaderFunction = ptr;
- ptr += pixelShaderSize;
</del><ins>+ for (size_t inputIndex = 0; inputIndex < gl::MAX_VERTEX_ATTRIBS; inputIndex++)
+ {
+ VertexFormat *vertexInput = &vertexInputs[inputIndex];
+ stream.read(&vertexInput->mType);
+ stream.read(&vertexInput->mNormalized);
+ stream.read(&vertexInput->mComponents);
+ stream.read(&vertexInput->mPureInteger);
+ }
</ins><span class="cx">
</span><del>- const char *vertexShaderFunction = ptr;
- ptr += vertexShaderSize;
</del><ins>+ unsigned int vertexShaderSize;
+ stream.read(&vertexShaderSize);
</ins><span class="cx">
</span><del>- const char *geometryShaderFunction = geometryShaderSize > 0 ? ptr : NULL;
- ptr += geometryShaderSize;
</del><ins>+ const char *vertexShaderFunction = (const char*) binary + stream.offset();
</ins><span class="cx">
</span><ins>+ rx::ShaderExecutable *shaderExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(vertexShaderFunction),
+ vertexShaderSize, rx::SHADER_VERTEX,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
+ if (!shaderExecutable)
+ {
+ infoLog.append("Could not create vertex shader.");
+ return false;
+ }
+
+ mVertexExecutables.push_back(new VertexExecutable(mRenderer, vertexInputs, shaderExecutable));
+
+ stream.skip(vertexShaderSize);
+ }
+
+ unsigned int pixelShaderSize;
+ stream.read(&pixelShaderSize);
+
+ const char *pixelShaderFunction = (const char*) binary + stream.offset();
</ins><span class="cx"> mPixelExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(pixelShaderFunction),
</span><del>- pixelShaderSize, rx::SHADER_PIXEL);
</del><ins>+ pixelShaderSize, rx::SHADER_PIXEL, mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
</ins><span class="cx"> if (!mPixelExecutable)
</span><span class="cx"> {
</span><span class="cx"> infoLog.append("Could not create pixel shader.");
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+ stream.skip(pixelShaderSize);
</ins><span class="cx">
</span><del>- mVertexExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(vertexShaderFunction),
- vertexShaderSize, rx::SHADER_VERTEX);
- if (!mVertexExecutable)
- {
- infoLog.append("Could not create vertex shader.");
- delete mPixelExecutable;
- mPixelExecutable = NULL;
- return false;
- }
</del><ins>+ unsigned int geometryShaderSize;
+ stream.read(&geometryShaderSize);
</ins><span class="cx">
</span><del>- if (geometryShaderFunction != NULL && geometryShaderSize > 0)
</del><ins>+ if (geometryShaderSize > 0)
</ins><span class="cx"> {
</span><ins>+ const char *geometryShaderFunction = (const char*) binary + stream.offset();
</ins><span class="cx"> mGeometryExecutable = mRenderer->loadExecutable(reinterpret_cast<const DWORD*>(geometryShaderFunction),
</span><del>- geometryShaderSize, rx::SHADER_GEOMETRY);
</del><ins>+ geometryShaderSize, rx::SHADER_GEOMETRY, mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
</ins><span class="cx"> if (!mGeometryExecutable)
</span><span class="cx"> {
</span><span class="cx"> infoLog.append("Could not create geometry shader.");
</span><del>- delete mPixelExecutable;
- mPixelExecutable = NULL;
- delete mVertexExecutable;
- mVertexExecutable = NULL;
</del><ins>+ SafeDelete(mPixelExecutable);
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+ stream.skip(geometryShaderSize);
</ins><span class="cx"> }
</span><del>- else
</del><ins>+
+ const char *ptr = (const char*) binary + stream.offset();
+
+ const GUID *binaryIdentifier = (const GUID *) ptr;
+ ptr += sizeof(GUID);
+
+ GUID identifier = mRenderer->getAdapterIdentifier();
+ if (memcmp(&identifier, binaryIdentifier, sizeof(GUID)) != 0)
</ins><span class="cx"> {
</span><del>- mGeometryExecutable = NULL;
</del><ins>+ infoLog.append("Invalid program binary.");
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ initializeUniformStorage();
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1815,6 +1328,8 @@
</span><span class="cx"> {
</span><span class="cx"> stream.write(mLinkedAttribute[i].type);
</span><span class="cx"> stream.write(mLinkedAttribute[i].name);
</span><ins>+ stream.write(mShaderAttributes[i].type);
+ stream.write(mShaderAttributes[i].name);
</ins><span class="cx"> stream.write(mSemanticIndex[i]);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1835,43 +1350,116 @@
</span><span class="cx"> stream.write(mUsedVertexSamplerRange);
</span><span class="cx"> stream.write(mUsedPixelSamplerRange);
</span><span class="cx"> stream.write(mUsesPointSize);
</span><ins>+ stream.write(mShaderVersion);
</ins><span class="cx">
</span><span class="cx"> stream.write(mUniforms.size());
</span><del>- for (unsigned int i = 0; i < mUniforms.size(); ++i)
</del><ins>+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
</ins><span class="cx"> {
</span><del>- stream.write(mUniforms[i]->type);
- stream.write(mUniforms[i]->precision);
- stream.write(mUniforms[i]->name);
- stream.write(mUniforms[i]->arraySize);
</del><ins>+ const LinkedUniform &uniform = *mUniforms[uniformIndex];
</ins><span class="cx">
</span><del>- stream.write(mUniforms[i]->psRegisterIndex);
- stream.write(mUniforms[i]->vsRegisterIndex);
- stream.write(mUniforms[i]->registerCount);
</del><ins>+ 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);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ stream.write(mUniformBlocks.size());
+ for (size_t uniformBlockIndex = 0; uniformBlockIndex < mUniformBlocks.size(); ++uniformBlockIndex)
+ {
+ const UniformBlock& 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 < uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
+ {
+ stream.write(uniformBlock.memberUniformIndexes[blockMemberIndex]);
+ }
+
+ stream.write(uniformBlock.psRegisterIndex);
+ stream.write(uniformBlock.vsRegisterIndex);
+ }
+
</ins><span class="cx"> stream.write(mUniformIndex.size());
</span><del>- for (unsigned int i = 0; i < mUniformIndex.size(); ++i)
</del><ins>+ for (size_t i = 0; i < mUniformIndex.size(); ++i)
</ins><span class="cx"> {
</span><span class="cx"> stream.write(mUniformIndex[i].name);
</span><span class="cx"> stream.write(mUniformIndex[i].element);
</span><span class="cx"> stream.write(mUniformIndex[i].index);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ stream.write(mTransformFeedbackBufferMode);
+ stream.write(mTransformFeedbackLinkedVaryings.size());
+ for (size_t i = 0; i < mTransformFeedbackLinkedVaryings.size(); i++)
+ {
+ const LinkedVarying &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 < mVertexExecutables.size(); vertexExecutableIndex++)
+ {
+ VertexExecutable *vertexExecutable = mVertexExecutables[vertexExecutableIndex];
+
+ for (size_t inputIndex = 0; inputIndex < gl::MAX_VERTEX_ATTRIBS; inputIndex++)
+ {
+ const VertexFormat &vertexInput = vertexExecutable->inputs()[inputIndex];
+ stream.write(vertexInput.mType);
+ stream.write(vertexInput.mNormalized);
+ stream.write(vertexInput.mComponents);
+ stream.write(vertexInput.mPureInteger);
+ }
+
+ UINT vertexShaderSize = vertexExecutable->shaderExecutable()->getLength();
+ stream.write(vertexShaderSize);
+
+ unsigned char *vertexBlob = static_cast<unsigned char *>(vertexExecutable->shaderExecutable()->getFunction());
+ stream.write(vertexBlob, vertexShaderSize);
+ }
+
</ins><span class="cx"> UINT pixelShaderSize = mPixelExecutable->getLength();
</span><span class="cx"> stream.write(pixelShaderSize);
</span><span class="cx">
</span><del>- UINT vertexShaderSize = mVertexExecutable->getLength();
- stream.write(vertexShaderSize);
</del><ins>+ unsigned char *pixelBlob = static_cast<unsigned char *>(mPixelExecutable->getFunction());
+ stream.write(pixelBlob, pixelShaderSize);
</ins><span class="cx">
</span><span class="cx"> UINT geometryShaderSize = (mGeometryExecutable != NULL) ? mGeometryExecutable->getLength() : 0;
</span><span class="cx"> stream.write(geometryShaderSize);
</span><span class="cx">
</span><ins>+ if (mGeometryExecutable != NULL && geometryShaderSize > 0)
+ {
+ unsigned char *geometryBlob = static_cast<unsigned char *>(mGeometryExecutable->getFunction());
+ stream.write(geometryBlob, geometryShaderSize);
+ }
+
</ins><span class="cx"> GUID identifier = mRenderer->getAdapterIdentifier();
</span><span class="cx">
</span><span class="cx"> GLsizei streamLength = stream.length();
</span><span class="cx"> const void *streamData = stream.data();
</span><span class="cx">
</span><del>- GLsizei totalLength = streamLength + sizeof(GUID) + pixelShaderSize + vertexShaderSize + geometryShaderSize;
</del><ins>+ GLsizei totalLength = streamLength + sizeof(GUID);
</ins><span class="cx"> if (totalLength > bufSize)
</span><span class="cx"> {
</span><span class="cx"> if (length)
</span><span class="lines">@@ -1892,18 +1480,6 @@
</span><span class="cx"> memcpy(ptr, &identifier, sizeof(GUID));
</span><span class="cx"> ptr += sizeof(GUID);
</span><span class="cx">
</span><del>- memcpy(ptr, mPixelExecutable->getFunction(), pixelShaderSize);
- ptr += pixelShaderSize;
-
- memcpy(ptr, mVertexExecutable->getFunction(), vertexShaderSize);
- ptr += vertexShaderSize;
-
- if (mGeometryExecutable != NULL && geometryShaderSize > 0)
- {
- memcpy(ptr, mGeometryExecutable->getFunction(), geometryShaderSize);
- ptr += geometryShaderSize;
- }
-
</del><span class="cx"> ASSERT(ptr - totalLength == binary);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1928,7 +1504,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader)
</del><ins>+bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings, GLenum transformFeedbackBufferMode)
</ins><span class="cx"> {
</span><span class="cx"> if (!fragmentShader || !fragmentShader->isCompiled())
</span><span class="cx"> {
</span><span class="lines">@@ -1940,23 +1517,38 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ mTransformFeedbackLinkedVaryings.clear();
+ mTransformFeedbackBufferMode = transformFeedbackBufferMode;
+
+ mShaderVersion = vertexShader->getShaderVersion();
+
</ins><span class="cx"> std::string pixelHLSL = fragmentShader->getHLSL();
</span><del>- std::string vertexHLSL = vertexShader->getHLSL();
</del><ins>+ mVertexHLSL = vertexShader->getHLSL();
+ mVertexWorkarounds = vertexShader->getD3DWorkarounds();
</ins><span class="cx">
</span><span class="cx"> // Map the varyings to the register file
</span><del>- const Varying *packing[IMPLEMENTATION_MAX_VARYING_VECTORS][4] = {NULL};
- int registers = packVaryings(infoLog, packing, fragmentShader);
</del><ins>+ const gl::ShaderVariable *packing[IMPLEMENTATION_MAX_VARYING_VECTORS][4] = {NULL};
+ int registers = mDynamicHLSL->packVaryings(infoLog, packing, fragmentShader, vertexShader, transformFeedbackVaryings);
</ins><span class="cx">
</span><span class="cx"> if (registers < 0)
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!linkVaryings(infoLog, registers, packing, pixelHLSL, vertexHLSL, fragmentShader, vertexShader))
</del><ins>+ if (!linkVaryings(infoLog, fragmentShader, vertexShader))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ mUsesPointSize = vertexShader->usesPointSize();
+ std::vector<LinkedVarying> linkedVaryings;
+ if (!mDynamicHLSL->generateShaderLinkHLSL(infoLog, registers, packing, pixelHLSL, mVertexHLSL,
+ fragmentShader, vertexShader, transformFeedbackVaryings,
+ &linkedVaryings, &mOutputVariables))
+ {
+ return false;
+ }
+
</ins><span class="cx"> bool success = true;
</span><span class="cx">
</span><span class="cx"> if (!linkAttributes(infoLog, attributeBindings, fragmentShader, vertexShader))
</span><span class="lines">@@ -1970,35 +1562,59 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // special case for gl_DepthRange, the only built-in uniform (also a struct)
</span><del>- if (vertexShader->mUsesDepthRange || fragmentShader->mUsesDepthRange)
</del><ins>+ if (vertexShader->usesDepthRange() || fragmentShader->usesDepthRange())
</ins><span class="cx"> {
</span><del>- mUniforms.push_back(new Uniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.near", 0));
- mUniforms.push_back(new Uniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.far", 0));
- mUniforms.push_back(new Uniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.diff", 0));
</del><ins>+ mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.near", 0, -1, gl::BlockMemberInfo::defaultBlockInfo));
+ mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.far", 0, -1, gl::BlockMemberInfo::defaultBlockInfo));
+ mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.diff", 0, -1, gl::BlockMemberInfo::defaultBlockInfo));
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (!linkUniformBlocks(infoLog, vertexShader->getInterfaceBlocks(), fragmentShader->getInterfaceBlocks()))
+ {
+ success = false;
+ }
+
+ if (!gatherTransformFeedbackLinkedVaryings(infoLog, linkedVaryings, transformFeedbackVaryings,
+ transformFeedbackBufferMode, &mTransformFeedbackLinkedVaryings))
+ {
+ success = false;
+ }
+
</ins><span class="cx"> if (success)
</span><span class="cx"> {
</span><del>- mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX, DiscardWorkaround(vertexShader->mUsesDiscardRewriting));
- mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL, DiscardWorkaround(fragmentShader->mUsesDiscardRewriting));
</del><ins>+ VertexFormat defaultInputLayout[MAX_VERTEX_ATTRIBS];
+ GetInputLayoutFromShader(vertexShader->activeAttributes(), defaultInputLayout);
</ins><span class="cx">
</span><ins>+ rx::ShaderExecutable *defaultVertexExecutable = getVertexExecutableForInputLayout(defaultInputLayout);
+ mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+ fragmentShader->getD3DWorkarounds());
+
</ins><span class="cx"> if (usesGeometryShader())
</span><span class="cx"> {
</span><del>- std::string geometryHLSL = generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader);
- mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY, rx::ANGLE_D3D_WORKAROUND_NONE);
</del><ins>+ std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader);
+ mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY,
+ mTransformFeedbackLinkedVaryings,
+ (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+ rx::ANGLE_D3D_WORKAROUND_NONE);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (!mVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable))
</del><ins>+ if (!defaultVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable))
</ins><span class="cx"> {
</span><span class="cx"> infoLog.append("Failed to create D3D shaders.");
</span><span class="cx"> success = false;
</span><span class="cx">
</span><del>- delete mVertexExecutable;
- mVertexExecutable = NULL;
- delete mPixelExecutable;
- mPixelExecutable = NULL;
- delete mGeometryExecutable;
- mGeometryExecutable = NULL;
</del><ins>+ while (!mVertexExecutables.empty())
+ {
+ delete mVertexExecutables.back();
+ mVertexExecutables.pop_back();
+ }
+
+ SafeDelete(mGeometryExecutable);
+ SafeDelete(mPixelExecutable);
+
+ mTransformFeedbackLinkedVaryings.clear();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2009,62 +1625,75 @@
</span><span class="cx"> bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader)
</span><span class="cx"> {
</span><span class="cx"> unsigned int usedLocations = 0;
</span><ins>+ const std::vector<gl::Attribute> &activeAttributes = vertexShader->activeAttributes();
</ins><span class="cx">
</span><span class="cx"> // Link attributes that have a binding location
</span><del>- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
</del><ins>+ for (unsigned int attributeIndex = 0; attributeIndex < activeAttributes.size(); attributeIndex++)
</ins><span class="cx"> {
</span><del>- int location = attributeBindings.getAttributeBinding(attribute->name);
</del><ins>+ const gl::Attribute &attribute = activeAttributes[attributeIndex];
+ const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
</ins><span class="cx">
</span><del>- if (location != -1) // Set by glBindAttribLocation
</del><ins>+ mShaderAttributes[attributeIndex] = attribute;
+
+ if (location != -1) // Set by glBindAttribLocation or by location layout qualifier
</ins><span class="cx"> {
</span><del>- if (!mLinkedAttribute[location].name.empty())
- {
- // Multiple active attributes bound to the same location; not an error
- }
</del><ins>+ const int rows = AttributeRegisterCount(attribute.type);
</ins><span class="cx">
</span><del>- mLinkedAttribute[location] = *attribute;
-
- int rows = VariableRowCount(attribute->type);
-
</del><span class="cx"> if (rows + location > MAX_VERTEX_ATTRIBS)
</span><span class="cx"> {
</span><del>- infoLog.append("Active attribute (%s) at location %d is too big to fit", attribute->name.c_str(), location);
</del><ins>+ infoLog.append("Active attribute (%s) at location %d is too big to fit", attribute.name.c_str(), location);
</ins><span class="cx">
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (int i = 0; i < rows; i++)
</del><ins>+ for (int row = 0; row < rows; row++)
</ins><span class="cx"> {
</span><del>- usedLocations |= 1 << (location + i);
</del><ins>+ const int rowLocation = location + row;
+ gl::ShaderVariable &linkedAttribute = mLinkedAttribute[rowLocation];
+
+ // In GLSL 3.00, attribute aliasing produces a link error
+ // In GLSL 1.00, attribute aliasing is allowed
+ if (mShaderVersion >= 300)
+ {
+ if (!linkedAttribute.name.empty())
+ {
+ infoLog.append("Attribute '%s' aliases attribute '%s' at location %d", attribute.name.c_str(), linkedAttribute.name.c_str(), rowLocation);
+ return false;
+ }
+ }
+
+ linkedAttribute = attribute;
+ usedLocations |= 1 << rowLocation;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Link attributes that don't have a binding location
</span><del>- for (AttributeArray::iterator attribute = vertexShader->mAttributes.begin(); attribute != vertexShader->mAttributes.end(); attribute++)
</del><ins>+ for (unsigned int attributeIndex = 0; attributeIndex < activeAttributes.size(); attributeIndex++)
</ins><span class="cx"> {
</span><del>- int location = attributeBindings.getAttributeBinding(attribute->name);
</del><ins>+ const gl::Attribute &attribute = activeAttributes[attributeIndex];
+ const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
</ins><span class="cx">
</span><del>- if (location == -1) // Not set by glBindAttribLocation
</del><ins>+ if (location == -1) // Not set by glBindAttribLocation or by location layout qualifier
</ins><span class="cx"> {
</span><del>- int rows = VariableRowCount(attribute->type);
</del><ins>+ int rows = AttributeRegisterCount(attribute.type);
</ins><span class="cx"> int availableIndex = AllocateFirstFreeBits(&usedLocations, rows, MAX_VERTEX_ATTRIBS);
</span><span class="cx">
</span><span class="cx"> if (availableIndex == -1 || availableIndex + rows > MAX_VERTEX_ATTRIBS)
</span><span class="cx"> {
</span><del>- infoLog.append("Too many active attributes (%s)", attribute->name.c_str());
</del><ins>+ infoLog.append("Too many active attributes (%s)", attribute.name.c_str());
</ins><span class="cx">
</span><span class="cx"> return false; // Fail to link
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mLinkedAttribute[availableIndex] = *attribute;
</del><ins>+ mLinkedAttribute[availableIndex] = attribute;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; )
</span><span class="cx"> {
</span><span class="cx"> int index = vertexShader->getSemanticIndex(mLinkedAttribute[attributeIndex].name);
</span><del>- int rows = std::max(VariableRowCount(mLinkedAttribute[attributeIndex].type), 1);
</del><ins>+ int rows = AttributeRegisterCount(mLinkedAttribute[attributeIndex].type);
</ins><span class="cx">
</span><span class="cx"> for (int r = 0; r < rows; r++)
</span><span class="cx"> {
</span><span class="lines">@@ -2077,32 +1706,262 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::linkUniforms(InfoLog &infoLog, const sh::ActiveUniforms &vertexUniforms, const sh::ActiveUniforms &fragmentUniforms)
</del><ins>+bool ProgramBinary::linkValidateVariablesBase(InfoLog &infoLog, const std::string &variableName, const gl::ShaderVariable &vertexVariable, const gl::ShaderVariable &fragmentVariable, bool validatePrecision)
</ins><span class="cx"> {
</span><del>- for (sh::ActiveUniforms::const_iterator uniform = vertexUniforms.begin(); uniform != vertexUniforms.end(); uniform++)
</del><ins>+ if (vertexVariable.type != fragmentVariable.type)
</ins><span class="cx"> {
</span><del>- if (!defineUniform(GL_VERTEX_SHADER, *uniform, infoLog))
</del><ins>+ infoLog.append("Types for %s differ between vertex and fragment shaders", variableName.c_str());
+ return false;
+ }
+ if (vertexVariable.arraySize != fragmentVariable.arraySize)
+ {
+ infoLog.append("Array sizes for %s differ between vertex and fragment shaders", variableName.c_str());
+ return false;
+ }
+ if (validatePrecision && vertexVariable.precision != fragmentVariable.precision)
+ {
+ infoLog.append("Precisions for %s differ between vertex and fragment shaders", variableName.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+template <class ShaderVarType>
+bool ProgramBinary::linkValidateFields(InfoLog &infoLog, const std::string &varName, const ShaderVarType &vertexVar, const ShaderVarType &fragmentVar)
+{
+ if (vertexVar.fields.size() != fragmentVar.fields.size())
+ {
+ infoLog.append("Structure lengths for %s differ between vertex and fragment shaders", varName.c_str());
+ return false;
+ }
+ const unsigned int numMembers = vertexVar.fields.size();
+ for (unsigned int memberIndex = 0; memberIndex < numMembers; memberIndex++)
+ {
+ const ShaderVarType &vertexMember = vertexVar.fields[memberIndex];
+ const ShaderVarType &fragmentMember = fragmentVar.fields[memberIndex];
+
+ if (vertexMember.name != fragmentMember.name)
</ins><span class="cx"> {
</span><ins>+ infoLog.append("Name mismatch for field '%d' of %s: (in vertex: '%s', in fragment: '%s')",
+ memberIndex, varName.c_str(), vertexMember.name.c_str(), fragmentMember.name.c_str());
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
+ const std::string memberName = varName.substr(0, varName.length()-1) + "." + vertexVar.name + "'";
+ if (!linkValidateVariables(infoLog, memberName, vertexMember, fragmentMember))
+ {
+ return false;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- for (sh::ActiveUniforms::const_iterator uniform = fragmentUniforms.begin(); uniform != fragmentUniforms.end(); uniform++)
</del><ins>+ return true;
+}
+
+bool ProgramBinary::linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const gl::Uniform &vertexUniform, const gl::Uniform &fragmentUniform)
+{
+ if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
</ins><span class="cx"> {
</span><del>- if (!defineUniform(GL_FRAGMENT_SHADER, *uniform, infoLog))
</del><ins>+ return false;
+ }
+
+ if (!linkValidateFields<gl::Uniform>(infoLog, uniformName, vertexUniform, fragmentUniform))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ProgramBinary::linkValidateVariables(InfoLog &infoLog, const std::string &varyingName, const gl::Varying &vertexVarying, const gl::Varying &fragmentVarying)
+{
+ if (!linkValidateVariablesBase(infoLog, varyingName, vertexVarying, fragmentVarying, false))
+ {
+ return false;
+ }
+
+ if (vertexVarying.interpolation != fragmentVarying.interpolation)
+ {
+ infoLog.append("Interpolation types for %s differ between vertex and fragment shaders", varyingName.c_str());
+ return false;
+ }
+
+ if (!linkValidateFields<gl::Varying>(infoLog, varyingName, vertexVarying, fragmentVarying))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ProgramBinary::linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const gl::InterfaceBlockField &vertexUniform, const gl::InterfaceBlockField &fragmentUniform)
+{
+ if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
+ {
+ return false;
+ }
+
+ if (vertexUniform.isRowMajorMatrix != fragmentUniform.isRowMajorMatrix)
+ {
+ infoLog.append("Matrix packings for %s differ between vertex and fragment shaders", uniformName.c_str());
+ return false;
+ }
+
+ if (!linkValidateFields<gl::InterfaceBlockField>(infoLog, uniformName, vertexUniform, fragmentUniform))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ProgramBinary::linkUniforms(InfoLog &infoLog, const std::vector<gl::Uniform> &vertexUniforms, const std::vector<gl::Uniform> &fragmentUniforms)
+{
+ // Check that uniforms defined in the vertex and fragment shaders are identical
+ typedef std::map<std::string, const gl::Uniform*> UniformMap;
+ UniformMap linkedUniforms;
+
+ for (unsigned int vertexUniformIndex = 0; vertexUniformIndex < vertexUniforms.size(); vertexUniformIndex++)
+ {
+ const gl::Uniform &vertexUniform = vertexUniforms[vertexUniformIndex];
+ linkedUniforms[vertexUniform.name] = &vertexUniform;
+ }
+
+ for (unsigned int fragmentUniformIndex = 0; fragmentUniformIndex < fragmentUniforms.size(); fragmentUniformIndex++)
+ {
+ const gl::Uniform &fragmentUniform = fragmentUniforms[fragmentUniformIndex];
+ UniformMap::const_iterator entry = linkedUniforms.find(fragmentUniform.name);
+ if (entry != linkedUniforms.end())
</ins><span class="cx"> {
</span><ins>+ const gl::Uniform &vertexUniform = *entry->second;
+ const std::string &uniformName = "uniform '" + vertexUniform.name + "'";
+ if (!linkValidateVariables(infoLog, uniformName, vertexUniform, fragmentUniform))
+ {
+ return false;
+ }
+ }
+ }
+
+ for (unsigned int uniformIndex = 0; uniformIndex < vertexUniforms.size(); uniformIndex++)
+ {
+ if (!defineUniform(GL_VERTEX_SHADER, vertexUniforms[uniformIndex], infoLog))
+ {
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ for (unsigned int uniformIndex = 0; uniformIndex < fragmentUniforms.size(); uniformIndex++)
+ {
+ if (!defineUniform(GL_FRAGMENT_SHADER, fragmentUniforms[uniformIndex], infoLog))
+ {
+ return false;
+ }
+ }
+
+ initializeUniformStorage();
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, InfoLog &infoLog)
</del><ins>+int totalRegisterCount(const gl::Uniform &uniform)
</ins><span class="cx"> {
</span><del>- if (constant.type == GL_SAMPLER_2D ||
- constant.type == GL_SAMPLER_CUBE)
</del><ins>+ int registerCount = 0;
+
+ if (!uniform.fields.empty())
</ins><span class="cx"> {
</span><ins>+ for (unsigned int fieldIndex = 0; fieldIndex < uniform.fields.size(); fieldIndex++)
+ {
+ registerCount += totalRegisterCount(uniform.fields[fieldIndex]);
+ }
+ }
+ else
+ {
+ registerCount = 1;
+ }
+
+ return (uniform.arraySize > 0) ? uniform.arraySize * registerCount : registerCount;
+}
+
+TextureType ProgramBinary::getTextureType(GLenum samplerType, InfoLog &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 &constant, InfoLog &infoLog)
+{
+ if (constant.isStruct())
+ {
+ if (constant.arraySize > 0)
+ {
+ unsigned int elementRegisterIndex = constant.registerIndex;
+
+ for (unsigned int elementIndex = 0; elementIndex < constant.arraySize; elementIndex++)
+ {
+ for (size_t fieldIndex = 0; fieldIndex < constant.fields.size(); fieldIndex++)
+ {
+ const gl::Uniform &field = constant.fields[fieldIndex];
+ const std::string &uniformName = constant.name + ArrayString(elementIndex) + "." + 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 < constant.fields.size(); fieldIndex++)
+ {
+ const gl::Uniform &field = constant.fields[fieldIndex];
+ const std::string &uniformName = constant.name + "." + 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))
+ {
</ins><span class="cx"> unsigned int samplerIndex = constant.registerIndex;
</span><span class="cx">
</span><span class="cx"> do
</span><span class="lines">@@ -2112,7 +1971,7 @@
</span><span class="cx"> if (samplerIndex < mRenderer->getMaxVertexTextureImageUnits())
</span><span class="cx"> {
</span><span class="cx"> mSamplersVS[samplerIndex].active = true;
</span><del>- mSamplersVS[samplerIndex].textureType = (constant.type == GL_SAMPLER_CUBE) ? TEXTURE_CUBE : TEXTURE_2D;
</del><ins>+ mSamplersVS[samplerIndex].textureType = getTextureType(constant.type, infoLog);
</ins><span class="cx"> mSamplersVS[samplerIndex].logicalTextureUnit = 0;
</span><span class="cx"> mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange);
</span><span class="cx"> }
</span><span class="lines">@@ -2127,7 +1986,7 @@
</span><span class="cx"> if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
</span><span class="cx"> {
</span><span class="cx"> mSamplersPS[samplerIndex].active = true;
</span><del>- mSamplersPS[samplerIndex].textureType = (constant.type == GL_SAMPLER_CUBE) ? TEXTURE_CUBE : TEXTURE_2D;
</del><ins>+ mSamplersPS[samplerIndex].textureType = getTextureType(constant.type, infoLog);
</ins><span class="cx"> mSamplersPS[samplerIndex].logicalTextureUnit = 0;
</span><span class="cx"> mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange);
</span><span class="cx"> }
</span><span class="lines">@@ -2144,28 +2003,17 @@
</span><span class="cx"> while (samplerIndex < constant.registerIndex + constant.arraySize);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Uniform *uniform = NULL;
</del><ins>+ LinkedUniform *uniform = NULL;
</ins><span class="cx"> GLint location = getUniformLocation(constant.name);
</span><span class="cx">
</span><span class="cx"> if (location >= 0) // Previously defined, type and precision must match
</span><span class="cx"> {
</span><span class="cx"> uniform = mUniforms[mUniformIndex[location].index];
</span><del>-
- if (uniform->type != constant.type)
- {
- infoLog.append("Types for uniform %s do not match between the vertex and fragment shader", uniform->name.c_str());
- return false;
- }
-
- if (uniform->precision != constant.precision)
- {
- infoLog.append("Precisions for uniform %s do not match between the vertex and fragment shader", uniform->name.c_str());
- return false;
- }
</del><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- uniform = new Uniform(constant.type, constant.precision, constant.name, constant.arraySize);
</del><ins>+ uniform = new LinkedUniform(constant.type, constant.precision, constant.name, constant.arraySize, -1, gl::BlockMemberInfo::defaultBlockInfo);
+ uniform->registerElement = constant.elementIndex;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!uniform)
</span><span class="lines">@@ -2191,9 +2039,9 @@
</span><span class="cx"> mUniforms.push_back(uniform);
</span><span class="cx"> unsigned int uniformIndex = mUniforms.size() - 1;
</span><span class="cx">
</span><del>- for (unsigned int i = 0; i < uniform->elementCount(); i++)
</del><ins>+ for (unsigned int arrayElementIndex = 0; arrayElementIndex < uniform->elementCount(); arrayElementIndex++)
</ins><span class="cx"> {
</span><del>- mUniformIndex.push_back(UniformLocation(constant.name, i, uniformIndex));
</del><ins>+ mUniformIndex.push_back(VariableLocation(uniform->name, arrayElementIndex, uniformIndex));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (shader == GL_VERTEX_SHADER)
</span><span class="lines">@@ -2217,152 +2065,268 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::string ProgramBinary::generateGeometryShaderHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const
</del><ins>+bool ProgramBinary::areMatchingInterfaceBlocks(InfoLog &infoLog, const gl::InterfaceBlock &vertexInterfaceBlock, const gl::InterfaceBlock &fragmentInterfaceBlock)
</ins><span class="cx"> {
</span><del>- // for now we only handle point sprite emulation
- ASSERT(usesPointSpriteEmulation());
- return generatePointSpriteHLSL(registers, packing, fragmentShader, vertexShader);
-}
</del><ins>+ const char* blockName = vertexInterfaceBlock.name.c_str();
</ins><span class="cx">
</span><del>-std::string ProgramBinary::generatePointSpriteHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const
-{
- ASSERT(registers >= 0);
- ASSERT(vertexShader->mUsesPointSize);
- ASSERT(mRenderer->getMajorShaderModel() >= 4);
</del><ins>+ // validate blocks for the same member types
+ if (vertexInterfaceBlock.fields.size() != fragmentInterfaceBlock.fields.size())
+ {
+ infoLog.append("Types for interface block '%s' differ between vertex and fragment shaders", blockName);
+ return false;
+ }
</ins><span class="cx">
</span><del>- std::string geomHLSL;
</del><ins>+ if (vertexInterfaceBlock.arraySize != fragmentInterfaceBlock.arraySize)
+ {
+ infoLog.append("Array sizes differ for interface block '%s' between vertex and fragment shaders", blockName);
+ return false;
+ }
</ins><span class="cx">
</span><del>- std::string varyingSemantic = "TEXCOORD";
</del><ins>+ if (vertexInterfaceBlock.layout != fragmentInterfaceBlock.layout || vertexInterfaceBlock.isRowMajorLayout != fragmentInterfaceBlock.isRowMajorLayout)
+ {
+ infoLog.append("Layout qualifiers differ for interface block '%s' between vertex and fragment shaders", blockName);
+ return false;
+ }
</ins><span class="cx">
</span><del>- std::string fragCoordSemantic;
- std::string pointCoordSemantic;
</del><ins>+ const unsigned int numBlockMembers = vertexInterfaceBlock.fields.size();
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++)
+ {
+ const gl::InterfaceBlockField &vertexMember = vertexInterfaceBlock.fields[blockMemberIndex];
+ const gl::InterfaceBlockField &fragmentMember = fragmentInterfaceBlock.fields[blockMemberIndex];
</ins><span class="cx">
</span><del>- int reservedRegisterIndex = registers;
</del><ins>+ if (vertexMember.name != fragmentMember.name)
+ {
+ infoLog.append("Name mismatch for field %d of interface block '%s': (in vertex: '%s', in fragment: '%s')",
+ blockMemberIndex, blockName, vertexMember.name.c_str(), fragmentMember.name.c_str());
+ return false;
+ }
</ins><span class="cx">
</span><del>- if (fragmentShader->mUsesFragCoord)
</del><ins>+ std::string uniformName = "interface block '" + vertexInterfaceBlock.name + "' member '" + vertexMember.name + "'";
+ if (!linkValidateVariables(infoLog, uniformName, vertexMember, fragmentMember))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ProgramBinary::linkUniformBlocks(InfoLog &infoLog, const std::vector<gl::InterfaceBlock> &vertexInterfaceBlocks,
+ const std::vector<gl::InterfaceBlock> &fragmentInterfaceBlocks)
+{
+ // Check that interface blocks defined in the vertex and fragment shaders are identical
+ typedef std::map<std::string, const gl::InterfaceBlock*> UniformBlockMap;
+ UniformBlockMap linkedUniformBlocks;
+
+ for (unsigned int blockIndex = 0; blockIndex < vertexInterfaceBlocks.size(); blockIndex++)
</ins><span class="cx"> {
</span><del>- fragCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
</del><ins>+ const gl::InterfaceBlock &vertexInterfaceBlock = vertexInterfaceBlocks[blockIndex];
+ linkedUniformBlocks[vertexInterfaceBlock.name] = &vertexInterfaceBlock;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (fragmentShader->mUsesPointCoord)
</del><ins>+ for (unsigned int blockIndex = 0; blockIndex < fragmentInterfaceBlocks.size(); blockIndex++)
</ins><span class="cx"> {
</span><del>- pointCoordSemantic = varyingSemantic + str(reservedRegisterIndex++);
</del><ins>+ const gl::InterfaceBlock &fragmentInterfaceBlock = fragmentInterfaceBlocks[blockIndex];
+ UniformBlockMap::const_iterator entry = linkedUniformBlocks.find(fragmentInterfaceBlock.name);
+ if (entry != linkedUniformBlocks.end())
+ {
+ const gl::InterfaceBlock &vertexInterfaceBlock = *entry->second;
+ if (!areMatchingInterfaceBlocks(infoLog, vertexInterfaceBlock, fragmentInterfaceBlock))
+ {
+ return false;
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- geomHLSL += "uniform float4 dx_ViewCoords : register(c1);\n"
- "\n"
- "struct GS_INPUT\n"
- "{\n";
-
- for (int r = 0; r < registers; r++)
</del><ins>+ for (unsigned int blockIndex = 0; blockIndex < vertexInterfaceBlocks.size(); blockIndex++)
</ins><span class="cx"> {
</span><del>- int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
-
- geomHLSL += " float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
</del><ins>+ if (!defineUniformBlock(infoLog, GL_VERTEX_SHADER, vertexInterfaceBlocks[blockIndex]))
+ {
+ return false;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (fragmentShader->mUsesFragCoord)
</del><ins>+ for (unsigned int blockIndex = 0; blockIndex < fragmentInterfaceBlocks.size(); blockIndex++)
</ins><span class="cx"> {
</span><del>- geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
</del><ins>+ if (!defineUniformBlock(infoLog, GL_FRAGMENT_SHADER, fragmentInterfaceBlocks[blockIndex]))
+ {
+ return false;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- geomHLSL += " float gl_PointSize : PSIZE;\n"
- " float4 gl_Position : SV_Position;\n"
- "};\n"
- "\n"
- "struct GS_OUTPUT\n"
- "{\n";
</del><ins>+ return true;
+}
</ins><span class="cx">
</span><del>- for (int r = 0; r < registers; r++)
</del><ins>+bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, const std::vector<LinkedVarying> &linkedVaryings,
+ const std::vector<std::string> &transformFeedbackVaryingNames,
+ GLenum transformFeedbackBufferMode,
+ std::vector<LinkedVarying> *outTransformFeedbackLinkedVaryings) const
+{
+ size_t totalComponents = 0;
+ const size_t maxSeparateComponents = mRenderer->getMaxTransformFeedbackSeparateComponents();
+ const size_t maxInterleavedComponents = mRenderer->getMaxTransformFeedbackInterleavedComponents();
+
+ // Gather the linked varyings that are used for transform feedback, they should all exist.
+ outTransformFeedbackLinkedVaryings->clear();
+ for (size_t i = 0; i < transformFeedbackVaryingNames.size(); i++)
</ins><span class="cx"> {
</span><del>- int registerSize = packing[r][3] ? 4 : (packing[r][2] ? 3 : (packing[r][1] ? 2 : 1));
</del><ins>+ bool found = false;
+ for (size_t j = 0; j < linkedVaryings.size(); j++)
+ {
+ if (transformFeedbackVaryingNames[i] == linkedVaryings[j].name)
+ {
+ for (size_t k = 0; k < outTransformFeedbackLinkedVaryings->size(); k++)
+ {
+ if (outTransformFeedbackLinkedVaryings->at(k).name == linkedVaryings[j].name)
+ {
+ infoLog.append("Two transform feedback varyings specify the same output variable (%s).", linkedVaryings[j].name.c_str());
+ return false;
+ }
+ }
</ins><span class="cx">
</span><del>- geomHLSL += " float" + str(registerSize) + " v" + str(r) + " : " + varyingSemantic + str(r) + ";\n";
</del><ins>+ size_t componentCount = linkedVaryings[j].semanticIndexCount * 4;
+ if (transformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &&
+ componentCount > maxSeparateComponents)
+ {
+ infoLog.append("Transform feedback varying's %s components (%u) exceed the maximum separate components (%u).",
+ linkedVaryings[j].name.c_str(), componentCount, maxSeparateComponents);
+ return false;
+ }
+
+ totalComponents += componentCount;
+
+ outTransformFeedbackLinkedVaryings->push_back(linkedVaryings[j]);
+ found = true;
+ break;
+ }
+ }
+
+ // All transform feedback varyings are expected to exist since packVaryings checks for them.
+ ASSERT(found);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (fragmentShader->mUsesFragCoord)
</del><ins>+ if (transformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS && totalComponents > maxInterleavedComponents)
</ins><span class="cx"> {
</span><del>- geomHLSL += " float4 gl_FragCoord : " + fragCoordSemantic + ";\n";
</del><ins>+ infoLog.append("Transform feedback varying total components (%u) exceed the maximum interleaved components (%u).",
+ totalComponents, maxInterleavedComponents);
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (fragmentShader->mUsesPointCoord)
</del><ins>+ return true;
+}
+
+void ProgramBinary::defineUniformBlockMembers(const std::vector<gl::InterfaceBlockField> &fields, const std::string &prefix, int blockIndex, BlockInfoItr *blockInfoItr, std::vector<unsigned int> *blockUniformIndexes)
+{
+ for (unsigned int uniformIndex = 0; uniformIndex < fields.size(); uniformIndex++)
</ins><span class="cx"> {
</span><del>- geomHLSL += " float2 gl_PointCoord : " + pointCoordSemantic + ";\n";
- }
</del><ins>+ const gl::InterfaceBlockField &field = fields[uniformIndex];
+ const std::string &fieldName = (prefix.empty() ? field.name : prefix + "." + field.name);
</ins><span class="cx">
</span><del>- geomHLSL += " float gl_PointSize : PSIZE;\n"
- " float4 gl_Position : SV_Position;\n"
- "};\n"
- "\n"
- "static float2 pointSpriteCorners[] = \n"
- "{\n"
- " float2( 0.5f, -0.5f),\n"
- " float2( 0.5f, 0.5f),\n"
- " float2(-0.5f, -0.5f),\n"
- " float2(-0.5f, 0.5f)\n"
- "};\n"
- "\n"
- "static float2 pointSpriteTexcoords[] = \n"
- "{\n"
- " float2(1.0f, 1.0f),\n"
- " float2(1.0f, 0.0f),\n"
- " float2(0.0f, 1.0f),\n"
- " float2(0.0f, 0.0f)\n"
- "};\n"
- "\n"
- "static float minPointSize = " + str(ALIASED_POINT_SIZE_RANGE_MIN) + ".0f;\n"
- "static float maxPointSize = " + str(mRenderer->getMaxPointSize()) + ".0f;\n"
- "\n"
- "[maxvertexcount(4)]\n"
- "void main(point GS_INPUT input[1], inout TriangleStream<GS_OUTPUT> outStream)\n"
- "{\n"
- " GS_OUTPUT output = (GS_OUTPUT)0;\n"
- " output.gl_PointSize = input[0].gl_PointSize;\n";
</del><ins>+ if (!field.fields.empty())
+ {
+ if (field.arraySize > 0)
+ {
+ for (unsigned int arrayElement = 0; arrayElement < 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);
</ins><span class="cx">
</span><del>- for (int r = 0; r < registers; r++)
- {
- geomHLSL += " output.v" + str(r) + " = input[0].v" + str(r) + ";\n";
</del><ins>+ // add to uniform list, but not index, since uniform block uniforms have no location
+ blockUniformIndexes->push_back(mUniforms.size());
+ mUniforms.push_back(newUniform);
+ (*blockInfoItr)++;
+ }
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- if (fragmentShader->mUsesFragCoord)
</del><ins>+bool ProgramBinary::defineUniformBlock(InfoLog &infoLog, GLenum shader, const gl::InterfaceBlock &interfaceBlock)
+{
+ // create uniform block entries if they do not exist
+ if (getUniformBlockIndex(interfaceBlock.name) == GL_INVALID_INDEX)
</ins><span class="cx"> {
</span><del>- geomHLSL += " output.gl_FragCoord = input[0].gl_FragCoord;\n";
</del><ins>+ std::vector<unsigned int> blockUniformIndexes;
+ const unsigned int blockIndex = mUniformBlocks.size();
+
+ // define member uniforms
+ BlockInfoItr blockInfoItr = interfaceBlock.blockInfo.cbegin();
+ defineUniformBlockMembers(interfaceBlock.fields, "", blockIndex, &blockInfoItr, &blockUniformIndexes);
+
+ // create all the uniform blocks
+ if (interfaceBlock.arraySize > 0)
+ {
+ for (unsigned int uniformBlockElement = 0; uniformBlockElement < interfaceBlock.arraySize; uniformBlockElement++)
+ {
+ gl::UniformBlock *newUniformBlock = new UniformBlock(interfaceBlock.name, uniformBlockElement, interfaceBlock.dataSize);
+ newUniformBlock->memberUniformIndexes = blockUniformIndexes;
+ mUniformBlocks.push_back(newUniformBlock);
+ }
+ }
+ else
+ {
+ gl::UniformBlock *newUniformBlock = new UniformBlock(interfaceBlock.name, GL_INVALID_INDEX, interfaceBlock.dataSize);
+ newUniformBlock->memberUniformIndexes = blockUniformIndexes;
+ mUniformBlocks.push_back(newUniformBlock);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- geomHLSL += " \n"
- " float gl_PointSize = clamp(input[0].gl_PointSize, minPointSize, maxPointSize);\n"
- " float4 gl_Position = input[0].gl_Position;\n"
- " float2 viewportScale = float2(1.0f / dx_ViewCoords.x, 1.0f / dx_ViewCoords.y) * gl_Position.w;\n";
</del><ins>+ // 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 <= mUniformBlocks.size());
</ins><span class="cx">
</span><del>- for (int corner = 0; corner < 4; corner++)
</del><ins>+ for (unsigned int uniformBlockElement = 0; uniformBlockElement < elementCount; uniformBlockElement++)
</ins><span class="cx"> {
</span><del>- geomHLSL += " \n"
- " output.gl_Position = gl_Position + float4(pointSpriteCorners[" + str(corner) + "] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n";
</del><ins>+ gl::UniformBlock *uniformBlock = mUniformBlocks[blockIndex + uniformBlockElement];
+ ASSERT(uniformBlock->name == interfaceBlock.name);
</ins><span class="cx">
</span><del>- if (fragmentShader->mUsesPointCoord)
</del><ins>+ if (!assignUniformBlockRegister(infoLog, uniformBlock, shader, interfaceBlock.registerIndex + uniformBlockElement))
</ins><span class="cx"> {
</span><del>- geomHLSL += " output.gl_PointCoord = pointSpriteTexcoords[" + str(corner) + "];\n";
</del><ins>+ return false;
</ins><span class="cx"> }
</span><del>-
- geomHLSL += " outStream.Append(output);\n";
</del><span class="cx"> }
</span><span class="cx">
</span><del>- geomHLSL += " \n"
- " outStream.RestartStrip();\n"
- "}\n";
-
- return geomHLSL;
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// This method needs to match OutputHLSL::decorate
-std::string ProgramBinary::decorateAttribute(const std::string &name)
</del><ins>+bool ProgramBinary::assignUniformBlockRegister(InfoLog &infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex)
</ins><span class="cx"> {
</span><del>- if (name.compare(0, 3, "gl_") != 0 && name.compare(0, 3, "dx_") != 0)
</del><ins>+ if (shader == GL_VERTEX_SHADER)
</ins><span class="cx"> {
</span><del>- return "_" + name;
</del><ins>+ uniformBlock->vsRegisterIndex = registerIndex;
+ unsigned int maximumBlocks = mRenderer->getMaxVertexShaderUniformBuffers();
+
+ if (registerIndex - mRenderer->getReservedVertexUniformBuffers() >= maximumBlocks)
+ {
+ infoLog.append("Vertex shader uniform block count exceed GL_MAX_VERTEX_UNIFORM_BLOCKS (%u)", maximumBlocks);
+ return false;
+ }
</ins><span class="cx"> }
</span><del>-
- return name;
</del><ins>+ else if (shader == GL_FRAGMENT_SHADER)
+ {
+ uniformBlock->psRegisterIndex = registerIndex;
+ unsigned int maximumBlocks = mRenderer->getMaxFragmentShaderUniformBuffers();
+
+ if (registerIndex - mRenderer->getReservedFragmentUniformBuffers() >= maximumBlocks)
+ {
+ infoLog.append("Fragment shader uniform block count exceed GL_MAX_FRAGMENT_UNIFORM_BLOCKS (%u)", maximumBlocks);
+ return false;
+ }
+ }
+ else UNREACHABLE();
+
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ProgramBinary::isValidated() const
</span><span class="lines">@@ -2491,6 +2455,116 @@
</span><span class="cx"> return maxLength;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLint ProgramBinary::getActiveUniformi(GLuint index, GLenum pname) const
+{
+ const gl::LinkedUniform& uniform = *mUniforms[index];
+
+ switch (pname)
+ {
+ case GL_UNIFORM_TYPE: return static_cast<GLint>(uniform.type);
+ case GL_UNIFORM_SIZE: return static_cast<GLint>(uniform.elementCount());
+ case GL_UNIFORM_NAME_LENGTH: return static_cast<GLint>(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<GLint>(uniform.blockInfo.isRowMajorMatrix);
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+ return 0;
+}
+
+void ProgramBinary::getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const
+{
+ ASSERT(uniformBlockIndex < mUniformBlocks.size()); // index must be smaller than getActiveUniformBlockCount()
+
+ const UniformBlock &uniformBlock = *mUniformBlocks[uniformBlockIndex];
+
+ if (bufSize > 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 < mUniformBlocks.size()); // index must be smaller than getActiveUniformBlockCount()
+
+ const UniformBlock &uniformBlock = *mUniformBlocks[uniformBlockIndex];
+
+ switch (pname)
+ {
+ case GL_UNIFORM_BLOCK_DATA_SIZE:
+ *params = static_cast<GLint>(uniformBlock.dataSize);
+ break;
+ case GL_UNIFORM_BLOCK_NAME_LENGTH:
+ *params = static_cast<GLint>(uniformBlock.name.size() + 1 + (uniformBlock.isArrayElement() ? 3 : 0));
+ break;
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+ *params = static_cast<GLint>(uniformBlock.memberUniformIndexes.size());
+ break;
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+ {
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
+ {
+ params[blockMemberIndex] = static_cast<GLint>(uniformBlock.memberUniformIndexes[blockMemberIndex]);
+ }
+ }
+ break;
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+ *params = static_cast<GLint>(uniformBlock.isReferencedByVertexShader());
+ break;
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+ *params = static_cast<GLint>(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 < numUniformBlocks; uniformBlockIndex++)
+ {
+ const UniformBlock &uniformBlock = *mUniformBlocks[uniformBlockIndex];
+ if (!uniformBlock.name.empty())
+ {
+ const unsigned int length = uniformBlock.name.length() + 1;
+
+ // Counting in "[0]".
+ const unsigned int arrayLength = (uniformBlock.isArrayElement() ? 3 : 0);
+
+ maxLength = std::max(length + arrayLength, maxLength);
+ }
+ }
+
+ return maxLength;
+}
+
</ins><span class="cx"> void ProgramBinary::validate(InfoLog &infoLog)
</span><span class="cx"> {
</span><span class="cx"> applyUniforms();
</span><span class="lines">@@ -2639,4 +2713,30 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ProgramBinary::initializeUniformStorage()
+{
+ // Compute total default block size
+ unsigned int vertexRegisters = 0;
+ unsigned int fragmentRegisters = 0;
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++)
+ {
+ const LinkedUniform &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->createUniformStorage(vertexRegisters * 16u);
+ mFragmentUniformStorage = mRenderer->createUniformStorage(fragmentRegisters * 16u);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ProgramBinaryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 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">@@ -11,6 +11,8 @@
</span><span class="cx"> #define LIBGLESV2_PROGRAM_BINARY_H_
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx"> #include <GLES2/gl2ext.h>
</span><span class="cx">
</span><span class="lines">@@ -19,16 +21,19 @@
</span><span class="cx">
</span><span class="cx"> #include "common/RefCountObject.h"
</span><span class="cx"> #include "angletypes.h"
</span><del>-#include "libGLESv2/mathutil.h"
</del><ins>+#include "common/mathutil.h"
</ins><span class="cx"> #include "libGLESv2/Uniform.h"
</span><span class="cx"> #include "libGLESv2/Shader.h"
</span><span class="cx"> #include "libGLESv2/Constants.h"
</span><ins>+#include "libGLESv2/renderer/VertexDataManager.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx"> class ShaderExecutable;
</span><span class="cx"> class Renderer;
</span><span class="cx"> struct TranslatedAttribute;
</span><ins>+class UniformStorage;
+class DynamicHLSL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="lines">@@ -37,22 +42,40 @@
</span><span class="cx"> class VertexShader;
</span><span class="cx"> class InfoLog;
</span><span class="cx"> class AttributeBindings;
</span><del>-struct Varying;
</del><ins>+class Buffer;
</ins><span class="cx">
</span><span class="cx"> // Struct used for correlating uniforms/elements of uniform arrays to handles
</span><del>-struct UniformLocation
</del><ins>+struct VariableLocation
</ins><span class="cx"> {
</span><del>- UniformLocation()
</del><ins>+ VariableLocation()
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- UniformLocation(const std::string &name, unsigned int element, unsigned int index);
</del><ins>+ VariableLocation(const std::string &name, unsigned int element, unsigned int index);
</ins><span class="cx">
</span><span class="cx"> std::string name;
</span><span class="cx"> unsigned int element;
</span><span class="cx"> unsigned int index;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+struct LinkedVarying
+{
+ LinkedVarying();
+ LinkedVarying(const std::string &name, GLenum type, GLsizei size, const std::string &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;
+};
+
</ins><span class="cx"> // This is the result of linking a program. It is the state that would be passed to ProgramBinary.
</span><span class="cx"> class ProgramBinary : public RefCountObject
</span><span class="cx"> {
</span><span class="lines">@@ -60,9 +83,9 @@
</span><span class="cx"> explicit ProgramBinary(rx::Renderer *renderer);
</span><span class="cx"> ~ProgramBinary();
</span><span class="cx">
</span><del>- rx::ShaderExecutable *getPixelExecutable();
- rx::ShaderExecutable *getVertexExecutable();
- rx::ShaderExecutable *getGeometryExecutable();
</del><ins>+ rx::ShaderExecutable *getPixelExecutable() const;
+ rx::ShaderExecutable *getVertexExecutableForInputLayout(const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS]);
+ rx::ShaderExecutable *getGeometryExecutable() const;
</ins><span class="cx">
</span><span class="cx"> GLuint getAttributeLocation(const char *name);
</span><span class="cx"> int getSemanticIndex(int attributeIndex);
</span><span class="lines">@@ -75,29 +98,44 @@
</span><span class="cx"> bool usesGeometryShader() const;
</span><span class="cx">
</span><span class="cx"> GLint getUniformLocation(std::string name);
</span><ins>+ GLuint getUniformIndex(std::string name);
+ GLuint getUniformBlockIndex(std::string name);
</ins><span class="cx"> bool setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
</span><span class="cx"> bool setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
</span><span class="cx"> bool setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
</span><span class="cx"> bool setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
</span><del>- bool setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value);
- bool setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value);
- bool setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value);
</del><span class="cx"> bool setUniform1iv(GLint location, GLsizei count, const GLint *v);
</span><span class="cx"> bool setUniform2iv(GLint location, GLsizei count, const GLint *v);
</span><span class="cx"> bool setUniform3iv(GLint location, GLsizei count, const GLint *v);
</span><span class="cx"> bool setUniform4iv(GLint location, GLsizei count, const GLint *v);
</span><ins>+ 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);
</ins><span class="cx">
</span><span class="cx"> bool getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params);
</span><span class="cx"> bool getUniformiv(GLint location, GLsizei *bufSize, GLint *params);
</span><ins>+ bool getUniformuiv(GLint location, GLsizei *bufSize, GLuint *params);
</ins><span class="cx">
</span><span class="cx"> void dirtyAllUniforms();
</span><span class="cx"> void applyUniforms();
</span><ins>+ bool applyUniformBuffers(const std::vector<Buffer*> boundBuffers);
</ins><span class="cx">
</span><span class="cx"> bool load(InfoLog &infoLog, const void *binary, GLsizei length);
</span><span class="cx"> bool save(void* binary, GLsizei bufSize, GLsizei *length);
</span><span class="cx"> GLint getLength();
</span><span class="cx">
</span><del>- bool link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
</del><ins>+ bool link(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader,
+ const std::vector<std::string>& transformFeedbackVaryings, GLenum transformFeedbackBufferMode);
</ins><span class="cx"> void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
</span><span class="cx">
</span><span class="cx"> void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
</span><span class="lines">@@ -107,44 +145,109 @@
</span><span class="cx"> void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
</span><span class="cx"> GLint getActiveUniformCount() const;
</span><span class="cx"> GLint getActiveUniformMaxLength() const;
</span><ins>+ GLint getActiveUniformi(GLuint index, GLenum pname) const;
</ins><span class="cx">
</span><ins>+ 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 &getTransformFeedbackVarying(size_t idx) const;
+ GLenum getTransformFeedbackBufferMode() const;
+
</ins><span class="cx"> void validate(InfoLog &infoLog);
</span><span class="cx"> bool validateSamplers(InfoLog *infoLog);
</span><span class="cx"> bool isValidated() const;
</span><span class="cx">
</span><span class="cx"> unsigned int getSerial() const;
</span><ins>+ int getShaderVersion() const;
</ins><span class="cx">
</span><span class="cx"> void initAttributesByLayout();
</span><del>- void sortAttributesByLayout(rx::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
</del><ins>+ void sortAttributesByLayout(rx::TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
</ins><span class="cx">
</span><del>- static std::string decorateAttribute(const std::string &name); // Prepend an underscore
</del><ins>+ const std::vector<LinkedUniform*> &getUniforms() const { return mUniforms; }
+ const rx::UniformStorage &getVertexUniformStorage() const { return *mVertexUniformStorage; }
+ const rx::UniformStorage &getFragmentUniformStorage() const { return *mFragmentUniformStorage; }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(ProgramBinary);
</span><span class="cx">
</span><del>- int packVaryings(InfoLog &infoLog, const Varying *packing[][4], FragmentShader *fragmentShader);
- bool linkVaryings(InfoLog &infoLog, int registers, const Varying *packing[][4],
- std::string& pixelHLSL, std::string& vertexHLSL,
- FragmentShader *fragmentShader, VertexShader *vertexShader);
-
</del><ins>+ bool linkVaryings(InfoLog &infoLog, FragmentShader *fragmentShader, VertexShader *vertexShader);
</ins><span class="cx"> bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
</span><span class="cx">
</span><del>- bool linkUniforms(InfoLog &infoLog, const sh::ActiveUniforms &vertexUniforms, const sh::ActiveUniforms &fragmentUniforms);
- bool defineUniform(GLenum shader, const sh::Uniform &constant, InfoLog &infoLog);
-
- std::string generateGeometryShaderHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const;
- std::string generatePointSpriteHLSL(int registers, const Varying *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const;
</del><ins>+ typedef BlockMemberInfoArray::const_iterator BlockInfoItr;
</ins><span class="cx">
</span><ins>+ template <class ShaderVarType>
+ bool linkValidateFields(InfoLog &infoLog, const std::string &varName, const ShaderVarType &vertexVar, const ShaderVarType &fragmentVar);
+ bool linkValidateVariablesBase(InfoLog &infoLog, const std::string &variableName, const ShaderVariable &vertexVariable, const ShaderVariable &fragmentVariable, bool validatePrecision);
+
+ bool linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const Uniform &vertexUniform, const Uniform &fragmentUniform);
+ bool linkValidateVariables(InfoLog &infoLog, const std::string &varyingName, const Varying &vertexVarying, const Varying &fragmentVarying);
+ bool linkValidateVariables(InfoLog &infoLog, const std::string &uniformName, const InterfaceBlockField &vertexUniform, const InterfaceBlockField &fragmentUniform);
+ bool linkUniforms(InfoLog &infoLog, const std::vector<Uniform> &vertexUniforms, const std::vector<Uniform> &fragmentUniforms);
+ bool defineUniform(GLenum shader, const Uniform &constant, InfoLog &infoLog);
+ bool areMatchingInterfaceBlocks(InfoLog &infoLog, const InterfaceBlock &vertexInterfaceBlock, const InterfaceBlock &fragmentInterfaceBlock);
+ bool linkUniformBlocks(InfoLog &infoLog, const std::vector<InterfaceBlock> &vertexUniformBlocks, const std::vector<InterfaceBlock> &fragmentUniformBlocks);
+ bool gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, const std::vector<LinkedVarying> &linkedVaryings,
+ const std::vector<std::string> &transformFeedbackVaryingNames,
+ GLenum transformFeedbackBufferMode,
+ std::vector<LinkedVarying> *outTransformFeedbackLinkedVaryings) const;
+ void defineUniformBlockMembers(const std::vector<InterfaceBlockField> &fields, const std::string &prefix, int blockIndex, BlockInfoItr *blockInfoItr, std::vector<unsigned int> *blockUniformIndexes);
+ bool defineUniformBlock(InfoLog &infoLog, GLenum shader, const InterfaceBlock &interfaceBlock);
+ bool assignUniformBlockRegister(InfoLog &infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex);
+ void defineOutputVariables(FragmentShader *fragmentShader);
+ void initializeUniformStorage();
+
+ template <typename T>
+ bool setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType);
+
+ template <int cols, int rows>
+ bool setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType);
+
+ template <typename T>
+ bool getUniformv(GLint location, GLsizei *bufSize, T *params, GLenum uniformType);
+
+ static TextureType getTextureType(GLenum samplerType, InfoLog &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;
+ };
+
</ins><span class="cx"> rx::Renderer *const mRenderer;
</span><ins>+ DynamicHLSL *mDynamicHLSL;
</ins><span class="cx">
</span><ins>+ std::string mVertexHLSL;
+ rx::D3DWorkaroundType mVertexWorkarounds;
+ std::vector<VertexExecutable *> mVertexExecutables;
+ rx::ShaderExecutable *mGeometryExecutable;
</ins><span class="cx"> rx::ShaderExecutable *mPixelExecutable;
</span><del>- rx::ShaderExecutable *mVertexExecutable;
- rx::ShaderExecutable *mGeometryExecutable;
</del><span class="cx">
</span><span class="cx"> Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
</span><ins>+ Attribute mShaderAttributes[MAX_VERTEX_ATTRIBS];
</ins><span class="cx"> int mSemanticIndex[MAX_VERTEX_ATTRIBS];
</span><span class="cx"> int mAttributesByLayout[MAX_VERTEX_ATTRIBS];
</span><span class="cx">
</span><ins>+ GLenum mTransformFeedbackBufferMode;
+ std::vector<LinkedVarying> mTransformFeedbackLinkedVaryings;
+
</ins><span class="cx"> struct Sampler
</span><span class="cx"> {
</span><span class="cx"> Sampler();
</span><span class="lines">@@ -159,10 +262,14 @@
</span><span class="cx"> GLuint mUsedVertexSamplerRange;
</span><span class="cx"> GLuint mUsedPixelSamplerRange;
</span><span class="cx"> bool mUsesPointSize;
</span><ins>+ int mShaderVersion;
</ins><span class="cx">
</span><del>- UniformArray mUniforms;
- typedef std::vector<UniformLocation> UniformIndex;
- UniformIndex mUniformIndex;
</del><ins>+ std::vector<LinkedUniform*> mUniforms;
+ std::vector<UniformBlock*> mUniformBlocks;
+ std::vector<VariableLocation> mUniformIndex;
+ std::map<int, VariableLocation> mOutputVariables;
+ rx::UniformStorage *mVertexUniformStorage;
+ rx::UniformStorage *mFragmentUniformStorage;
</ins><span class="cx">
</span><span class="cx"> bool mValidated;
</span><span class="cx">
</span><span class="lines">@@ -171,6 +278,7 @@
</span><span class="cx"> static unsigned int issueSerial();
</span><span class="cx"> static unsigned int mCurrentSerial;
</span><span class="cx"> };
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // LIBGLESV2_PROGRAM_BINARY_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Queryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,6 +10,7 @@
</span><span class="cx"> #define LIBGLESV2_QUERY_H_
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Renderbuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -14,7 +14,9 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/Texture.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "libGLESv2/renderer/TextureStorage.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
</ins><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="lines">@@ -35,39 +37,9 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GLuint RenderbufferInterface::getRedSize() const
-{
- return gl::GetRedSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getGreenSize() const
-{
- return gl::GetGreenSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getBlueSize() const
-{
- return gl::GetBlueSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getAlphaSize() const
-{
- return gl::GetAlphaSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getDepthSize() const
-{
- return gl::GetDepthSize(getActualFormat());
-}
-
-GLuint RenderbufferInterface::getStencilSize() const
-{
- return gl::GetStencilSize(getActualFormat());
-}
-
</del><span class="cx"> ///// RenderbufferTexture2D Implementation ////////
</span><span class="cx">
</span><del>-RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLenum target) : mTarget(target)
</del><ins>+RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLint level) : mLevel(level)
</ins><span class="cx"> {
</span><span class="cx"> mTexture2D.set(texture);
</span><span class="cx"> }
</span><span class="lines">@@ -91,32 +63,37 @@
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *RenderbufferTexture2D::getRenderTarget()
</span><span class="cx"> {
</span><del>- return mTexture2D->getRenderTarget(mTarget);
</del><ins>+ return mTexture2D->getRenderTarget(mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *RenderbufferTexture2D::getDepthStencil()
</span><span class="cx"> {
</span><del>- return mTexture2D->getDepthStencil(mTarget);
</del><ins>+ return mTexture2D->getDepthSencil(mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+rx::TextureStorage *RenderbufferTexture2D::getTextureStorage()
+{
+ return mTexture2D->getNativeTexture()->getStorageInstance();
+}
+
</ins><span class="cx"> GLsizei RenderbufferTexture2D::getWidth() const
</span><span class="cx"> {
</span><del>- return mTexture2D->getWidth(0);
</del><ins>+ return mTexture2D->getWidth(mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLsizei RenderbufferTexture2D::getHeight() const
</span><span class="cx"> {
</span><del>- return mTexture2D->getHeight(0);
</del><ins>+ return mTexture2D->getHeight(mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum RenderbufferTexture2D::getInternalFormat() const
</span><span class="cx"> {
</span><del>- return mTexture2D->getInternalFormat(0);
</del><ins>+ return mTexture2D->getInternalFormat(mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum RenderbufferTexture2D::getActualFormat() const
</span><span class="cx"> {
</span><del>- return mTexture2D->getActualFormat(0);
</del><ins>+ return mTexture2D->getActualFormat(mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLsizei RenderbufferTexture2D::getSamples() const
</span><span class="lines">@@ -126,7 +103,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned int RenderbufferTexture2D::getSerial() const
</span><span class="cx"> {
</span><del>- return mTexture2D->getRenderTargetSerial(mTarget);
</del><ins>+ return mTexture2D->getRenderTargetSerial(mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> unsigned int RenderbufferTexture2D::getTextureSerial() const
</span><span class="lines">@@ -136,7 +113,8 @@
</span><span class="cx">
</span><span class="cx"> ///// RenderbufferTextureCubeMap Implementation ////////
</span><span class="cx">
</span><del>-RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target) : mTarget(target)
</del><ins>+RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum faceTarget, GLint level)
+ : mFaceTarget(faceTarget), mLevel(level)
</ins><span class="cx"> {
</span><span class="cx"> mTextureCubeMap.set(texture);
</span><span class="cx"> }
</span><span class="lines">@@ -160,32 +138,37 @@
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *RenderbufferTextureCubeMap::getRenderTarget()
</span><span class="cx"> {
</span><del>- return mTextureCubeMap->getRenderTarget(mTarget);
</del><ins>+ return mTextureCubeMap->getRenderTarget(mFaceTarget, mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *RenderbufferTextureCubeMap::getDepthStencil()
</span><span class="cx"> {
</span><del>- return NULL;
</del><ins>+ return mTextureCubeMap->getDepthStencil(mFaceTarget, mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+rx::TextureStorage *RenderbufferTextureCubeMap::getTextureStorage()
+{
+ return mTextureCubeMap->getNativeTexture()->getStorageInstance();
+}
+
</ins><span class="cx"> GLsizei RenderbufferTextureCubeMap::getWidth() const
</span><span class="cx"> {
</span><del>- return mTextureCubeMap->getWidth(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
</del><ins>+ return mTextureCubeMap->getWidth(mFaceTarget, mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLsizei RenderbufferTextureCubeMap::getHeight() const
</span><span class="cx"> {
</span><del>- return mTextureCubeMap->getHeight(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
</del><ins>+ return mTextureCubeMap->getHeight(mFaceTarget, mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum RenderbufferTextureCubeMap::getInternalFormat() const
</span><span class="cx"> {
</span><del>- return mTextureCubeMap->getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
</del><ins>+ return mTextureCubeMap->getInternalFormat(mFaceTarget, mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum RenderbufferTextureCubeMap::getActualFormat() const
</span><span class="cx"> {
</span><del>- return mTextureCubeMap->getActualFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0);
</del><ins>+ return mTextureCubeMap->getActualFormat(mFaceTarget, mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLsizei RenderbufferTextureCubeMap::getSamples() const
</span><span class="lines">@@ -195,7 +178,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned int RenderbufferTextureCubeMap::getSerial() const
</span><span class="cx"> {
</span><del>- return mTextureCubeMap->getRenderTargetSerial(mTarget);
</del><ins>+ return mTextureCubeMap->getRenderTargetSerial(mFaceTarget, mLevel);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> unsigned int RenderbufferTextureCubeMap::getTextureSerial() const
</span><span class="lines">@@ -203,12 +186,163 @@
</span><span class="cx"> return mTextureCubeMap->getTextureSerial();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+///// 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->addProxyRef(proxy);
+}
+
+void RenderbufferTexture3DLayer::releaseProxy(const Renderbuffer *proxy)
+{
+ mTexture3D->releaseProxy(proxy);
+}
+
+rx::RenderTarget *RenderbufferTexture3DLayer::getRenderTarget()
+{
+ return mTexture3D->getRenderTarget(mLevel, mLayer);
+}
+
+rx::RenderTarget *RenderbufferTexture3DLayer::getDepthStencil()
+{
+ return mTexture3D->getDepthStencil(mLevel, mLayer);
+}
+
+rx::TextureStorage *RenderbufferTexture3DLayer::getTextureStorage()
+{
+ return mTexture3D->getNativeTexture()->getStorageInstance();
+}
+
+GLsizei RenderbufferTexture3DLayer::getWidth() const
+{
+ return mTexture3D->getWidth(mLevel);
+}
+
+GLsizei RenderbufferTexture3DLayer::getHeight() const
+{
+ return mTexture3D->getHeight(mLevel);
+}
+
+GLenum RenderbufferTexture3DLayer::getInternalFormat() const
+{
+ return mTexture3D->getInternalFormat(mLevel);
+}
+
+GLenum RenderbufferTexture3DLayer::getActualFormat() const
+{
+ return mTexture3D->getActualFormat(mLevel);
+}
+
+GLsizei RenderbufferTexture3DLayer::getSamples() const
+{
+ return 0;
+}
+
+unsigned int RenderbufferTexture3DLayer::getSerial() const
+{
+ return mTexture3D->getRenderTargetSerial(mLevel, mLayer);
+}
+
+unsigned int RenderbufferTexture3DLayer::getTextureSerial() const
+{
+ return mTexture3D->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->addProxyRef(proxy);
+}
+
+void RenderbufferTexture2DArrayLayer::releaseProxy(const Renderbuffer *proxy)
+{
+ mTexture2DArray->releaseProxy(proxy);
+}
+
+rx::RenderTarget *RenderbufferTexture2DArrayLayer::getRenderTarget()
+{
+ return mTexture2DArray->getRenderTarget(mLevel, mLayer);
+}
+
+rx::RenderTarget *RenderbufferTexture2DArrayLayer::getDepthStencil()
+{
+ return mTexture2DArray->getDepthStencil(mLevel, mLayer);
+}
+
+rx::TextureStorage *RenderbufferTexture2DArrayLayer::getTextureStorage()
+{
+ return mTexture2DArray->getNativeTexture()->getStorageInstance();
+}
+
+GLsizei RenderbufferTexture2DArrayLayer::getWidth() const
+{
+ return mTexture2DArray->getWidth(mLevel);
+}
+
+GLsizei RenderbufferTexture2DArrayLayer::getHeight() const
+{
+ return mTexture2DArray->getHeight(mLevel);
+}
+
+GLenum RenderbufferTexture2DArrayLayer::getInternalFormat() const
+{
+ return mTexture2DArray->getInternalFormat(mLevel);
+}
+
+GLenum RenderbufferTexture2DArrayLayer::getActualFormat() const
+{
+ return mTexture2DArray->getActualFormat(mLevel);
+}
+
+GLsizei RenderbufferTexture2DArrayLayer::getSamples() const
+{
+ return 0;
+}
+
+unsigned int RenderbufferTexture2DArrayLayer::getSerial() const
+{
+ return mTexture2DArray->getRenderTargetSerial(mLevel, mLayer);
+}
+
+unsigned int RenderbufferTexture2DArrayLayer::getTextureSerial() const
+{
+ return mTexture2DArray->getTextureSerial();
+}
+
</ins><span class="cx"> ////// Renderbuffer Implementation //////
</span><span class="cx">
</span><span class="cx"> Renderbuffer::Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *instance) : RefCountObject(id)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(instance != NULL);
</span><span class="cx"> mInstance = instance;
</span><ins>+
+ ASSERT(renderer != NULL);
+ mRenderer = renderer;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderbuffer::~Renderbuffer()
</span><span class="lines">@@ -242,6 +376,11 @@
</span><span class="cx"> return mInstance->getDepthStencil();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+rx::TextureStorage *Renderbuffer::getTextureStorage()
+{
+ return mInstance->getTextureStorage();
+}
+
</ins><span class="cx"> GLsizei Renderbuffer::getWidth() const
</span><span class="cx"> {
</span><span class="cx"> return mInstance->getWidth();
</span><span class="lines">@@ -264,34 +403,44 @@
</span><span class="cx">
</span><span class="cx"> GLuint Renderbuffer::getRedSize() const
</span><span class="cx"> {
</span><del>- return mInstance->getRedSize();
</del><ins>+ return gl::GetRedBits(getActualFormat(), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Renderbuffer::getGreenSize() const
</span><span class="cx"> {
</span><del>- return mInstance->getGreenSize();
</del><ins>+ return gl::GetGreenBits(getActualFormat(), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Renderbuffer::getBlueSize() const
</span><span class="cx"> {
</span><del>- return mInstance->getBlueSize();
</del><ins>+ return gl::GetBlueBits(getActualFormat(), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Renderbuffer::getAlphaSize() const
</span><span class="cx"> {
</span><del>- return mInstance->getAlphaSize();
</del><ins>+ return gl::GetAlphaBits(getActualFormat(), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Renderbuffer::getDepthSize() const
</span><span class="cx"> {
</span><del>- return mInstance->getDepthSize();
</del><ins>+ return gl::GetDepthBits(getActualFormat(), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Renderbuffer::getStencilSize() const
</span><span class="cx"> {
</span><del>- return mInstance->getStencilSize();
</del><ins>+ return gl::GetStencilBits(getActualFormat(), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+GLenum Renderbuffer::getComponentType() const
+{
+ return gl::GetComponentType(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
+GLenum Renderbuffer::getColorEncoding() const
+{
+ return gl::GetColorEncoding(getActualFormat(), mRenderer->getCurrentClientVersion());
+}
+
</ins><span class="cx"> GLsizei Renderbuffer::getSamples() const
</span><span class="cx"> {
</span><span class="cx"> return mInstance->getSamples();
</span><span class="lines">@@ -315,7 +464,7 @@
</span><span class="cx"> mInstance = newStorage;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerial())
</del><ins>+RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerials(1))
</ins><span class="cx"> {
</span><span class="cx"> mWidth = 0;
</span><span class="cx"> mHeight = 0;
</span><span class="lines">@@ -338,6 +487,11 @@
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+rx::TextureStorage *RenderbufferStorage::getTextureStorage()
+{
+ return NULL;
+}
+
</ins><span class="cx"> GLsizei RenderbufferStorage::getWidth() const
</span><span class="cx"> {
</span><span class="cx"> return mWidth;
</span><span class="lines">@@ -368,15 +522,10 @@
</span><span class="cx"> return mSerial;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int RenderbufferStorage::issueSerial()
</del><ins>+unsigned int RenderbufferStorage::issueSerials(GLuint count)
</ins><span class="cx"> {
</span><del>- return mCurrentSerial++;
-}
-
-unsigned int RenderbufferStorage::issueCubeSerials()
-{
</del><span class="cx"> unsigned int firstSerial = mCurrentSerial;
</span><del>- mCurrentSerial += 6;
</del><ins>+ mCurrentSerial += count;
</ins><span class="cx"> return firstSerial;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -396,7 +545,7 @@
</span><span class="cx">
</span><span class="cx"> Colorbuffer::Colorbuffer(rx::Renderer *renderer, int width, int height, GLenum format, GLsizei samples) : mRenderTarget(NULL)
</span><span class="cx"> {
</span><del>- mRenderTarget = renderer->createRenderTarget(width, height, format, samples, false);
</del><ins>+ mRenderTarget = renderer->createRenderTarget(width, height, format, samples);
</ins><span class="cx">
</span><span class="cx"> if (mRenderTarget)
</span><span class="cx"> {
</span><span class="lines">@@ -418,12 +567,7 @@
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *Colorbuffer::getRenderTarget()
</span><span class="cx"> {
</span><del>- if (mRenderTarget)
- {
- return mRenderTarget;
- }
-
- return NULL;
</del><ins>+ return mRenderTarget;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> DepthStencilbuffer::DepthStencilbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain)
</span><span class="lines">@@ -442,7 +586,7 @@
</span><span class="cx"> DepthStencilbuffer::DepthStencilbuffer(rx::Renderer *renderer, int width, int height, GLsizei samples)
</span><span class="cx"> {
</span><span class="cx">
</span><del>- mDepthStencil = renderer->createRenderTarget(width, height, GL_DEPTH24_STENCIL8_OES, samples, true);
</del><ins>+ mDepthStencil = renderer->createRenderTarget(width, height, GL_DEPTH24_STENCIL8_OES, samples);
</ins><span class="cx">
</span><span class="cx"> mWidth = mDepthStencil->getWidth();
</span><span class="cx"> mHeight = mDepthStencil->getHeight();
</span><span class="lines">@@ -461,12 +605,7 @@
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *DepthStencilbuffer::getDepthStencil()
</span><span class="cx"> {
</span><del>- if (mDepthStencil)
- {
- return mDepthStencil;
- }
-
- return NULL;
</del><ins>+ return mDepthStencil;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Depthbuffer::Depthbuffer(rx::Renderer *renderer, int width, int height, GLsizei samples) : DepthStencilbuffer(renderer, width, height, samples)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Renderbufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,6 +13,7 @@
</span><span class="cx"> #define LIBGLESV2_RENDERBUFFER_H_
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><span class="lines">@@ -23,12 +24,15 @@
</span><span class="cx"> class Renderer;
</span><span class="cx"> class SwapChain;
</span><span class="cx"> class RenderTarget;
</span><ins>+class TextureStorage;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx"> class Texture2D;
</span><span class="cx"> class TextureCubeMap;
</span><ins>+class Texture3D;
+class Texture2DArray;
</ins><span class="cx"> class Renderbuffer;
</span><span class="cx"> class Colorbuffer;
</span><span class="cx"> class DepthStencilbuffer;
</span><span class="lines">@@ -45,6 +49,7 @@
</span><span class="cx">
</span><span class="cx"> virtual rx::RenderTarget *getRenderTarget() = 0;
</span><span class="cx"> virtual rx::RenderTarget *getDepthStencil() = 0;
</span><ins>+ virtual rx::TextureStorage *getTextureStorage() = 0;
</ins><span class="cx">
</span><span class="cx"> virtual GLsizei getWidth() const = 0;
</span><span class="cx"> virtual GLsizei getHeight() const = 0;
</span><span class="lines">@@ -52,13 +57,6 @@
</span><span class="cx"> virtual GLenum getActualFormat() const = 0;
</span><span class="cx"> virtual GLsizei getSamples() const = 0;
</span><span class="cx">
</span><del>- GLuint getRedSize() const;
- GLuint getGreenSize() const;
- GLuint getBlueSize() const;
- GLuint getAlphaSize() const;
- GLuint getDepthSize() const;
- GLuint getStencilSize() const;
-
</del><span class="cx"> virtual unsigned int getSerial() const = 0;
</span><span class="cx"> virtual unsigned int getTextureSerial() const = 0;
</span><span class="cx">
</span><span class="lines">@@ -69,7 +67,7 @@
</span><span class="cx"> class RenderbufferTexture2D : public RenderbufferInterface
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- RenderbufferTexture2D(Texture2D *texture, GLenum target);
</del><ins>+ RenderbufferTexture2D(Texture2D *texture, GLint level);
</ins><span class="cx">
</span><span class="cx"> virtual ~RenderbufferTexture2D();
</span><span class="cx">
</span><span class="lines">@@ -78,6 +76,7 @@
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *getRenderTarget();
</span><span class="cx"> rx::RenderTarget *getDepthStencil();
</span><ins>+ rx::TextureStorage *getTextureStorage();
</ins><span class="cx">
</span><span class="cx"> virtual GLsizei getWidth() const;
</span><span class="cx"> virtual GLsizei getHeight() const;
</span><span class="lines">@@ -92,13 +91,13 @@
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2D);
</span><span class="cx">
</span><span class="cx"> BindingPointer <Texture2D> mTexture2D;
</span><del>- GLenum mTarget;
</del><ins>+ const GLint mLevel;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class RenderbufferTextureCubeMap : public RenderbufferInterface
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target);
</del><ins>+ RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum faceTarget, GLint level);
</ins><span class="cx">
</span><span class="cx"> virtual ~RenderbufferTextureCubeMap();
</span><span class="cx">
</span><span class="lines">@@ -107,6 +106,7 @@
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *getRenderTarget();
</span><span class="cx"> rx::RenderTarget *getDepthStencil();
</span><ins>+ rx::TextureStorage *getTextureStorage();
</ins><span class="cx">
</span><span class="cx"> virtual GLsizei getWidth() const;
</span><span class="cx"> virtual GLsizei getHeight() const;
</span><span class="lines">@@ -121,9 +121,72 @@
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(RenderbufferTextureCubeMap);
</span><span class="cx">
</span><span class="cx"> BindingPointer <TextureCubeMap> mTextureCubeMap;
</span><del>- GLenum mTarget;
</del><ins>+ const GLint mLevel;
+ const GLenum mFaceTarget;
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+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<Texture3D> 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<Texture2DArray> mTexture2DArray;
+ const GLint mLevel;
+ const GLint mLayer;
+};
+
</ins><span class="cx"> // A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
</span><span class="cx"> // is called. The specific concrete type depends on whether the internal format is
</span><span class="cx"> // colour depth, stencil or packed depth/stencil.
</span><span class="lines">@@ -136,6 +199,7 @@
</span><span class="cx">
</span><span class="cx"> virtual rx::RenderTarget *getRenderTarget();
</span><span class="cx"> virtual rx::RenderTarget *getDepthStencil();
</span><ins>+ virtual rx::TextureStorage *getTextureStorage();
</ins><span class="cx">
</span><span class="cx"> virtual GLsizei getWidth() const;
</span><span class="cx"> virtual GLsizei getHeight() const;
</span><span class="lines">@@ -146,8 +210,7 @@
</span><span class="cx"> virtual unsigned int getSerial() const;
</span><span class="cx"> virtual unsigned int getTextureSerial() const { return 0; }
</span><span class="cx">
</span><del>- static unsigned int issueSerial();
- static unsigned int issueCubeSerials();
</del><ins>+ static unsigned int issueSerials(GLuint count);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> GLsizei mWidth;
</span><span class="lines">@@ -183,6 +246,7 @@
</span><span class="cx">
</span><span class="cx"> rx::RenderTarget *getRenderTarget();
</span><span class="cx"> rx::RenderTarget *getDepthStencil();
</span><ins>+ rx::TextureStorage *getTextureStorage();
</ins><span class="cx">
</span><span class="cx"> GLsizei getWidth() const;
</span><span class="cx"> GLsizei getHeight() const;
</span><span class="lines">@@ -194,6 +258,8 @@
</span><span class="cx"> GLuint getAlphaSize() const;
</span><span class="cx"> GLuint getDepthSize() const;
</span><span class="cx"> GLuint getStencilSize() const;
</span><ins>+ GLenum getComponentType() const;
+ GLenum getColorEncoding() const;
</ins><span class="cx"> GLsizei getSamples() const;
</span><span class="cx">
</span><span class="cx"> unsigned int getSerial() const;
</span><span class="lines">@@ -204,6 +270,7 @@
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
</span><span class="cx">
</span><ins>+ rx::Renderer const *mRenderer;
</ins><span class="cx"> RenderbufferInterface *mInstance;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2RenderbufferProxySetcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+#include "precompiled.h"
+//
+// 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 "libGLESv2/RenderbufferProxySet.h"
+#include "common/debug.h"
+
+namespace gl
+{
+
+void RenderbufferProxySet::addRef(const Renderbuffer *proxy)
+{
+ RefCountMap::iterator i = mRefCountMap.find(proxy);
+ if (i != mRefCountMap.end())
+ {
+ i->second++;
+ }
+}
+
+void RenderbufferProxySet::release(const Renderbuffer *proxy)
+{
+ RefCountMap::iterator i = mRefCountMap.find(proxy);
+ if (i != mRefCountMap.end())
+ {
+ if (i->second > 0)
+ {
+ i->second--;
+ }
+
+ if (i->second == 0)
+ {
+ // Clear the buffer map of references to this Renderbuffer
+ BufferMap::iterator j = mBufferMap.begin();
+ while (j != mBufferMap.end())
+ {
+ if (j->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->second : NULL;
+}
+
+bool RenderbufferProxySet::RenderbufferKey::operator<(const RenderbufferKey &other) const
+{
+ return (mipLevel != other.mipLevel) ? mipLevel < other.mipLevel : layer < other.layer;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2RenderbufferProxySeth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,46 @@
</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.
+//
+
+// 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 <map>
+
+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<(const RenderbufferKey &other) const;
+ };
+
+ typedef std::map<RenderbufferKey, Renderbuffer*> BufferMap;
+ BufferMap mBufferMap;
+
+ typedef std::map<const Renderbuffer*, unsigned int> RefCountMap;
+ RefCountMap mRefCountMap;
+};
+
+}
+
+#endif // LIBGLESV2_RENDERBUFFERPROXYSET_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ResourceManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -15,6 +15,8 @@
</span><span class="cx"> #include "libGLESv2/Renderbuffer.h"
</span><span class="cx"> #include "libGLESv2/Shader.h"
</span><span class="cx"> #include "libGLESv2/Texture.h"
</span><ins>+#include "libGLESv2/Sampler.h"
+#include "libGLESv2/Fence.h"
</ins><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="lines">@@ -50,6 +52,16 @@
</span><span class="cx"> {
</span><span class="cx"> deleteTexture(mTextureMap.begin()->first);
</span><span class="cx"> }
</span><ins>+
+ while (!mSamplerMap.empty())
+ {
+ deleteSampler(mSamplerMap.begin()->first);
+ }
+
+ while (!mFenceSyncMap.empty())
+ {
+ deleteFenceSync(mFenceSyncMap.begin()->first);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ResourceManager::addRef()
</span><span class="lines">@@ -123,6 +135,26 @@
</span><span class="cx"> return handle;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// 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;
+}
+
</ins><span class="cx"> void ResourceManager::deleteBuffer(GLuint buffer)
</span><span class="cx"> {
</span><span class="cx"> BufferMap::iterator bufferObject = mBufferMap.find(buffer);
</span><span class="lines">@@ -197,6 +229,30 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ResourceManager::deleteSampler(GLuint sampler)
+{
+ auto samplerObject = mSamplerMap.find(sampler);
+
+ if (samplerObject != mSamplerMap.end())
+ {
+ mSamplerHandleAllocator.release(samplerObject->first);
+ if (samplerObject->second) samplerObject->second->release();
+ mSamplerMap.erase(samplerObject);
+ }
+}
+
+void ResourceManager::deleteFenceSync(GLuint fenceSync)
+{
+ auto fenceObjectIt = mFenceSyncMap.find(fenceSync);
+
+ if (fenceObjectIt != mFenceSyncMap.end())
+ {
+ mFenceSyncHandleAllocator.release(fenceObjectIt->first);
+ if (fenceObjectIt->second) fenceObjectIt->second->release();
+ mFenceSyncMap.erase(fenceObjectIt);
+ }
+}
+
</ins><span class="cx"> Buffer *ResourceManager::getBuffer(unsigned int handle)
</span><span class="cx"> {
</span><span class="cx"> BufferMap::iterator buffer = mBufferMap.find(handle);
</span><span class="lines">@@ -269,6 +325,34 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Sampler *ResourceManager::getSampler(unsigned int handle)
+{
+ auto sampler = mSamplerMap.find(handle);
+
+ if (sampler == mSamplerMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return sampler->second;
+ }
+}
+
+FenceSync *ResourceManager::getFenceSync(unsigned int handle)
+{
+ auto fenceObjectIt = mFenceSyncMap.find(handle);
+
+ if (fenceObjectIt == mFenceSyncMap.end())
+ {
+ return NULL;
+ }
+ else
+ {
+ return fenceObjectIt->second;
+ }
+}
+
</ins><span class="cx"> void ResourceManager::setRenderbuffer(GLuint handle, Renderbuffer *buffer)
</span><span class="cx"> {
</span><span class="cx"> mRenderbufferMap[handle] = buffer;
</span><span class="lines">@@ -298,6 +382,14 @@
</span><span class="cx"> {
</span><span class="cx"> textureObject = new TextureCubeMap(mRenderer, texture);
</span><span class="cx"> }
</span><ins>+ else if (type == TEXTURE_3D)
+ {
+ textureObject = new Texture3D(mRenderer, texture);
+ }
+ else if (type == TEXTURE_2D_ARRAY)
+ {
+ textureObject = new Texture2DArray(mRenderer, texture);
+ }
</ins><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> UNREACHABLE();
</span><span class="lines">@@ -319,4 +411,19 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ResourceManager::checkSamplerAllocation(GLuint sampler)
+{
+ if (sampler != 0 && !getSampler(sampler))
+ {
+ Sampler *samplerObject = new Sampler(sampler);
+ mSamplerMap[sampler] = samplerObject;
+ samplerObject->addRef();
+ }
</ins><span class="cx"> }
</span><ins>+
+bool ResourceManager::isSampler(GLuint sampler)
+{
+ return mSamplerMap.find(sampler) != mSamplerMap.end();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ResourceManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h        2014-04-30 22:57:08 UTC (rev 168055)
</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-2013 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">@@ -11,13 +11,10 @@
</span><span class="cx"> #define LIBGLESV2_RESOURCEMANAGER_H_
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><del>-#ifdef _MSC_VER
-#include <hash_map>
-#else
</del><span class="cx"> #include <unordered_map>
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><span class="cx"> #include "libGLESv2/angletypes.h"
</span><span class="lines">@@ -35,6 +32,8 @@
</span><span class="cx"> class Program;
</span><span class="cx"> class Texture;
</span><span class="cx"> class Renderbuffer;
</span><ins>+class Sampler;
+class FenceSync;
</ins><span class="cx">
</span><span class="cx"> class ResourceManager
</span><span class="cx"> {
</span><span class="lines">@@ -50,57 +49,66 @@
</span><span class="cx"> GLuint createProgram();
</span><span class="cx"> GLuint createTexture();
</span><span class="cx"> GLuint createRenderbuffer();
</span><ins>+ GLuint createSampler();
+ GLuint createFenceSync();
</ins><span class="cx">
</span><span class="cx"> void deleteBuffer(GLuint buffer);
</span><span class="cx"> void deleteShader(GLuint shader);
</span><span class="cx"> void deleteProgram(GLuint program);
</span><span class="cx"> void deleteTexture(GLuint texture);
</span><span class="cx"> void deleteRenderbuffer(GLuint renderbuffer);
</span><ins>+ void deleteSampler(GLuint sampler);
+ void deleteFenceSync(GLuint fenceSync);
</ins><span class="cx">
</span><span class="cx"> Buffer *getBuffer(GLuint handle);
</span><span class="cx"> Shader *getShader(GLuint handle);
</span><span class="cx"> Program *getProgram(GLuint handle);
</span><span class="cx"> Texture *getTexture(GLuint handle);
</span><span class="cx"> Renderbuffer *getRenderbuffer(GLuint handle);
</span><ins>+ Sampler *getSampler(GLuint handle);
+ FenceSync *getFenceSync(GLuint handle);
</ins><span class="cx">
</span><span class="cx"> void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
</span><span class="cx">
</span><span class="cx"> void checkBufferAllocation(unsigned int buffer);
</span><span class="cx"> void checkTextureAllocation(GLuint texture, TextureType type);
</span><span class="cx"> void checkRenderbufferAllocation(GLuint renderbuffer);
</span><ins>+ void checkSamplerAllocation(GLuint sampler);
</ins><span class="cx">
</span><ins>+ bool isSampler(GLuint sampler);
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(ResourceManager);
</span><span class="cx">
</span><span class="cx"> std::size_t mRefCount;
</span><span class="cx"> rx::Renderer *mRenderer;
</span><span class="cx">
</span><del>-#ifndef HASH_MAP
-# ifdef _MSC_VER
-# define HASH_MAP stdext::hash_map
-# else
-# define HASH_MAP std::unordered_map
-# endif
-#endif
-
- typedef HASH_MAP<GLuint, Buffer*> BufferMap;
</del><ins>+ typedef std::unordered_map<GLuint, Buffer*> BufferMap;
</ins><span class="cx"> BufferMap mBufferMap;
</span><span class="cx"> HandleAllocator mBufferHandleAllocator;
</span><span class="cx">
</span><del>- typedef HASH_MAP<GLuint, Shader*> ShaderMap;
</del><ins>+ typedef std::unordered_map<GLuint, Shader*> ShaderMap;
</ins><span class="cx"> ShaderMap mShaderMap;
</span><span class="cx">
</span><del>- typedef HASH_MAP<GLuint, Program*> ProgramMap;
</del><ins>+ typedef std::unordered_map<GLuint, Program*> ProgramMap;
</ins><span class="cx"> ProgramMap mProgramMap;
</span><span class="cx"> HandleAllocator mProgramShaderHandleAllocator;
</span><span class="cx">
</span><del>- typedef HASH_MAP<GLuint, Texture*> TextureMap;
</del><ins>+ typedef std::unordered_map<GLuint, Texture*> TextureMap;
</ins><span class="cx"> TextureMap mTextureMap;
</span><span class="cx"> HandleAllocator mTextureHandleAllocator;
</span><span class="cx">
</span><del>- typedef HASH_MAP<GLuint, Renderbuffer*> RenderbufferMap;
</del><ins>+ typedef std::unordered_map<GLuint, Renderbuffer*> RenderbufferMap;
</ins><span class="cx"> RenderbufferMap mRenderbufferMap;
</span><span class="cx"> HandleAllocator mRenderbufferHandleAllocator;
</span><ins>+
+ typedef std::unordered_map<GLuint, Sampler*> SamplerMap;
+ SamplerMap mSamplerMap;
+ HandleAllocator mSamplerHandleAllocator;
+
+ typedef std::unordered_map<GLuint, FenceSync*> FenceMap;
+ FenceMap mFenceSyncMap;
+ HandleAllocator mFenceSyncHandleAllocator;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Samplercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+#include "precompiled.h"
+//
+// 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 "libGLESv2/Sampler.h"
+#include "libGLESv2/angletypes.h"
+
+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->minFilter = mMinFilter;
+ samplerState->magFilter = mMagFilter;
+ samplerState->wrapS = mWrapS;
+ samplerState->wrapT = mWrapT;
+ samplerState->wrapR = mWrapR;
+ samplerState->minLod = mMinLod;
+ samplerState->maxLod = mMaxLod;
+ samplerState->compareMode = mComparisonMode;
+ samplerState->compareFunc = mComparisonFunc;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Samplerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.h        2014-04-30 22:57:08 UTC (rev 168055)
</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 LIBGLESV2_SAMPLER_H_
+#define LIBGLESV2_SAMPLER_H_
+
+#include "common/RefCountObject.h"
+
+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_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Shadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> #include "libGLESv2/Shader.h"
</span><span class="cx">
</span><span class="cx"> #include "GLSLANG/ShaderLang.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
</ins><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><span class="cx"> #include "libGLESv2/Constants.h"
</span><span class="cx"> #include "libGLESv2/ResourceManager.h"
</span><span class="lines">@@ -25,22 +25,16 @@
</span><span class="cx"> Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
</span><span class="cx"> : mHandle(handle), mRenderer(renderer), mResourceManager(manager)
</span><span class="cx"> {
</span><del>- mSource = NULL;
- mHlsl = NULL;
- mInfoLog = NULL;
-
</del><span class="cx"> uncompile();
</span><span class="cx"> initializeCompiler();
</span><span class="cx">
</span><span class="cx"> mRefCount = 0;
</span><span class="cx"> mDeleteStatus = false;
</span><ins>+ mShaderVersion = 100;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Shader::~Shader()
</span><span class="cx"> {
</span><del>- delete[] mSource;
- delete[] mHlsl;
- delete[] mInfoLog;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLuint Shader::getHandle() const
</span><span class="lines">@@ -48,69 +42,31 @@
</span><span class="cx"> return mHandle;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Shader::setSource(GLsizei count, const char **string, const GLint *length)
</del><ins>+void Shader::setSource(GLsizei count, const char *const *string, const GLint *length)
</ins><span class="cx"> {
</span><del>- delete[] mSource;
- int totalLength = 0;
</del><ins>+ std::ostringstream stream;
</ins><span class="cx">
</span><span class="cx"> for (int i = 0; i < count; i++)
</span><span class="cx"> {
</span><del>- if (length && length[i] >= 0)
- {
- totalLength += length[i];
- }
- else
- {
- totalLength += (int)strlen(string[i]);
- }
</del><ins>+ stream << string[i];
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- mSource = new char[totalLength + 1];
- char *code = mSource;
-
- for (int i = 0; i < count; i++)
- {
- int stringLength;
-
- if (length && length[i] >= 0)
- {
- stringLength = length[i];
- }
- else
- {
- stringLength = (int)strlen(string[i]);
- }
-
- strncpy(code, string[i], stringLength);
- code += stringLength;
- }
-
- mSource[totalLength] = '\0';
</del><ins>+ mSource = stream.str();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int Shader::getInfoLogLength() const
</span><span class="cx"> {
</span><del>- if (!mInfoLog)
- {
- return 0;
- }
- else
- {
- return strlen(mInfoLog) + 1;
- }
</del><ins>+ return mInfoLog.empty() ? 0 : (mInfoLog.length() + 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
</del><ins>+void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
</ins><span class="cx"> {
</span><span class="cx"> int index = 0;
</span><span class="cx">
</span><span class="cx"> if (bufSize > 0)
</span><span class="cx"> {
</span><del>- if (mInfoLog)
- {
- index = std::min(bufSize - 1, (int)strlen(mInfoLog));
- memcpy(infoLog, mInfoLog, index);
- }
</del><ins>+ index = std::min(bufSize - 1, static_cast<GLsizei>(mInfoLog.length()));
+ memcpy(infoLog, mInfoLog.c_str(), index);
</ins><span class="cx">
</span><span class="cx"> infoLog[index] = '\0';
</span><span class="cx"> }
</span><span class="lines">@@ -123,39 +79,22 @@
</span><span class="cx">
</span><span class="cx"> int Shader::getSourceLength() const
</span><span class="cx"> {
</span><del>- if (!mSource)
- {
- return 0;
- }
- else
- {
- return strlen(mSource) + 1;
- }
</del><ins>+ return mSource.empty() ? 0 : (mSource.length() + 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int Shader::getTranslatedSourceLength() const
</span><span class="cx"> {
</span><del>- if (!mHlsl)
- {
- return 0;
- }
- else
- {
- return strlen(mHlsl) + 1;
- }
</del><ins>+ return mHlsl.empty() ? 0 : (mHlsl.length() + 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer)
</del><ins>+void Shader::getSourceImpl(const std::string &source, GLsizei bufSize, GLsizei *length, char *buffer) const
</ins><span class="cx"> {
</span><span class="cx"> int index = 0;
</span><span class="cx">
</span><span class="cx"> if (bufSize > 0)
</span><span class="cx"> {
</span><del>- if (source)
- {
- index = std::min(bufSize - 1, (int)strlen(source));
- memcpy(buffer, source, index);
- }
</del><ins>+ index = std::min(bufSize - 1, static_cast<GLsizei>(source.length()));
+ memcpy(buffer, source.c_str(), index);
</ins><span class="cx">
</span><span class="cx"> buffer[index] = '\0';
</span><span class="cx"> }
</span><span class="lines">@@ -166,28 +105,38 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer)
</del><ins>+void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer) const
</ins><span class="cx"> {
</span><span class="cx"> getSourceImpl(mSource, bufSize, length, buffer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer)
</del><ins>+void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const
</ins><span class="cx"> {
</span><span class="cx"> getSourceImpl(mHlsl, bufSize, length, buffer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-const sh::ActiveUniforms &Shader::getUniforms()
</del><ins>+const std::vector<Uniform> &Shader::getUniforms() const
</ins><span class="cx"> {
</span><span class="cx"> return mActiveUniforms;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Shader::isCompiled()
</del><ins>+const std::vector<InterfaceBlock> &Shader::getInterfaceBlocks() const
</ins><span class="cx"> {
</span><del>- return mHlsl != NULL;
</del><ins>+ return mActiveInterfaceBlocks;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-const char *Shader::getHLSL()
</del><ins>+std::vector<Varying> &Shader::getVaryings()
</ins><span class="cx"> {
</span><ins>+ return mVaryings;
+}
+
+bool Shader::isCompiled() const
+{
+ return !mHlsl.empty();
+}
+
+const std::string &Shader::getHLSL() const
+{
</ins><span class="cx"> return mHlsl;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -245,9 +194,15 @@
</span><span class="cx"> resources.MaxDrawBuffers = mRenderer->getMaxRenderTargets();
</span><span class="cx"> resources.OES_standard_derivatives = mRenderer->getDerivativeInstructionSupport();
</span><span class="cx"> resources.EXT_draw_buffers = mRenderer->getMaxRenderTargets() > 1;
</span><ins>+ resources.EXT_shader_texture_lod = 1;
</ins><span class="cx"> // resources.OES_EGL_image_external = mRenderer->getShareHandleSupport() ? 1 : 0; // TODO: commented out until the extension is actually supported.
</span><span class="cx"> resources.FragmentPrecisionHigh = 1; // Shader Model 2+ always supports FP24 (s16e7) which corresponds to highp
</span><span class="cx"> resources.EXT_frag_depth = 1; // Shader Model 2+ always supports explicit depth output
</span><ins>+ // GLSL ES 3.0 constants
+ resources.MaxVertexOutputVectors = mRenderer->getMaxVaryingVectors();
+ resources.MaxFragmentInputVectors = mRenderer->getMaxVaryingVectors();
+ resources.MinProgramTexelOffset = -8; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE
+ resources.MaxProgramTexelOffset = 7; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE
</ins><span class="cx">
</span><span class="cx"> mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
</span><span class="cx"> mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
</span><span class="lines">@@ -266,57 +221,33 @@
</span><span class="cx"> ShFinalize();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Shader::parseVaryings()
</del><ins>+void Shader::parseVaryings(void *compiler)
</ins><span class="cx"> {
</span><del>- if (mHlsl)
</del><ins>+ if (!mHlsl.empty())
</ins><span class="cx"> {
</span><del>- const char *input = strstr(mHlsl, "// Varyings") + 12;
</del><ins>+ std::vector<Varying> *activeVaryings;
+ ShGetInfoPointer(compiler, SH_ACTIVE_VARYINGS_ARRAY, reinterpret_cast<void**>(&activeVaryings));
+ mVaryings = *activeVaryings;
</ins><span class="cx">
</span><del>- while(true)
- {
- char varyingType[256];
- char varyingName[256];
-
- int matches = sscanf(input, "static %255s %255s", varyingType, varyingName);
-
- if (matches != 2)
- {
- break;
- }
-
- char *array = strstr(varyingName, "[");
- int size = 1;
-
- if (array)
- {
- size = atoi(array + 1);
- *array = '\0';
- }
-
- mVaryings.push_back(Varying(parseType(varyingType), varyingName, size, array != NULL));
-
- input = strstr(input, ";") + 2;
- }
-
- mUsesMultipleRenderTargets = strstr(mHlsl, "GL_USES_MRT") != NULL;
- mUsesFragColor = strstr(mHlsl, "GL_USES_FRAG_COLOR") != NULL;
- mUsesFragData = strstr(mHlsl, "GL_USES_FRAG_DATA") != NULL;
- mUsesFragCoord = strstr(mHlsl, "GL_USES_FRAG_COORD") != NULL;
- mUsesFrontFacing = strstr(mHlsl, "GL_USES_FRONT_FACING") != NULL;
- mUsesPointSize = strstr(mHlsl, "GL_USES_POINT_SIZE") != NULL;
- mUsesPointCoord = strstr(mHlsl, "GL_USES_POINT_COORD") != NULL;
- mUsesDepthRange = strstr(mHlsl, "GL_USES_DEPTH_RANGE") != NULL;
- mUsesFragDepth = strstr(mHlsl, "GL_USES_FRAG_DEPTH") != NULL;
- mUsesDiscardRewriting = strstr(mHlsl, "ANGLE_USES_DISCARD_REWRITING") != NULL;
</del><ins>+ mUsesMultipleRenderTargets = mHlsl.find("GL_USES_MRT") != std::string::npos;
+ mUsesFragColor = mHlsl.find("GL_USES_FRAG_COLOR") != std::string::npos;
+ mUsesFragData = mHlsl.find("GL_USES_FRAG_DATA") != std::string::npos;
+ mUsesFragCoord = mHlsl.find("GL_USES_FRAG_COORD") != std::string::npos;
+ mUsesFrontFacing = mHlsl.find("GL_USES_FRONT_FACING") != std::string::npos;
+ mUsesPointSize = mHlsl.find("GL_USES_POINT_SIZE") != std::string::npos;
+ mUsesPointCoord = mHlsl.find("GL_USES_POINT_COORD") != std::string::npos;
+ mUsesDepthRange = mHlsl.find("GL_USES_DEPTH_RANGE") != std::string::npos;
+ mUsesFragDepth = mHlsl.find("GL_USES_FRAG_DEPTH") != std::string::npos;
+ mUsesDiscardRewriting = mHlsl.find("ANGLE_USES_DISCARD_REWRITING") != std::string::npos;
+ mUsesNestedBreak = mHlsl.find("ANGLE_USES_NESTED_BREAK") != std::string::npos;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Shader::resetVaryingsRegisterAssignment()
</span><span class="cx"> {
</span><del>- for (VaryingList::iterator var = mVaryings.begin(); var != mVaryings.end(); var++)
</del><ins>+ for (unsigned int varyingIndex = 0; varyingIndex < mVaryings.size(); varyingIndex++)
</ins><span class="cx"> {
</span><del>- var->reg = -1;
- var->col = -1;
</del><ins>+ mVaryings[varyingIndex].resetRegisterAssignment();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -324,10 +255,8 @@
</span><span class="cx"> void Shader::uncompile()
</span><span class="cx"> {
</span><span class="cx"> // set by compileToHLSL
</span><del>- delete[] mHlsl;
- mHlsl = NULL;
- delete[] mInfoLog;
- mInfoLog = NULL;
</del><ins>+ mHlsl.clear();
+ mInfoLog.clear();
</ins><span class="cx">
</span><span class="cx"> // set by parseVaryings
</span><span class="cx"> mVaryings.clear();
</span><span class="lines">@@ -341,20 +270,16 @@
</span><span class="cx"> mUsesPointCoord = false;
</span><span class="cx"> mUsesDepthRange = false;
</span><span class="cx"> mUsesFragDepth = false;
</span><ins>+ mShaderVersion = 100;
</ins><span class="cx"> mUsesDiscardRewriting = false;
</span><ins>+ mUsesNestedBreak = false;
</ins><span class="cx">
</span><span class="cx"> mActiveUniforms.clear();
</span><ins>+ mActiveInterfaceBlocks.clear();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Shader::compileToHLSL(void *compiler)
</span><span class="cx"> {
</span><del>- // ensure we don't pass a NULL source to the compiler
- const char *source = "\0";
- if (mSource)
- {
- source = mSource;
- }
-
</del><span class="cx"> // ensure the compiler is loaded
</span><span class="cx"> initializeCompiler();
</span><span class="cx">
</span><span class="lines">@@ -363,166 +288,191 @@
</span><span class="cx"> if (perfActive())
</span><span class="cx"> {
</span><span class="cx"> sourcePath = getTempPath();
</span><del>- writeFile(sourcePath.c_str(), source, strlen(source));
</del><ins>+ writeFile(sourcePath.c_str(), mSource.c_str(), mSource.length());
</ins><span class="cx"> compileOptions |= SH_LINE_DIRECTIVES;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int result;
</span><span class="cx"> if (sourcePath.empty())
</span><span class="cx"> {
</span><del>- result = ShCompile(compiler, &source, 1, compileOptions);
</del><ins>+ const char* sourceStrings[] =
+ {
+ mSource.c_str(),
+ };
+
+ result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- const char* sourceStrings[2] =
</del><ins>+ const char* sourceStrings[] =
</ins><span class="cx"> {
</span><span class="cx"> sourcePath.c_str(),
</span><del>- source
</del><ins>+ mSource.c_str(),
</ins><span class="cx"> };
</span><span class="cx">
</span><del>- result = ShCompile(compiler, sourceStrings, 2, compileOptions | SH_SOURCE_PATH);
</del><ins>+ result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (result)
</del><ins>+ size_t shaderVersion = 100;
+ ShGetInfo(compiler, SH_SHADER_VERSION, &shaderVersion);
+
+ mShaderVersion = static_cast<int>(shaderVersion);
+
+ if (shaderVersion == 300 && mRenderer->getCurrentClientVersion() < 3)
</ins><span class="cx"> {
</span><ins>+ mInfoLog = "GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts";
+ TRACE("\n%s", mInfoLog.c_str());
+ }
+ else if (result)
+ {
</ins><span class="cx"> size_t objCodeLen = 0;
</span><span class="cx"> ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen);
</span><del>- mHlsl = new char[objCodeLen];
- ShGetObjectCode(compiler, mHlsl);
</del><span class="cx">
</span><ins>+ char* outputHLSL = new char[objCodeLen];
+ ShGetObjectCode(compiler, outputHLSL);
+
+#ifdef _DEBUG
+ std::ostringstream hlslStream;
+ hlslStream << "// GLSL\n";
+ hlslStream << "//\n";
+
+ size_t curPos = 0;
+ while (curPos != std::string::npos)
+ {
+ size_t nextLine = mSource.find("\n", curPos);
+ size_t len = (nextLine == std::string::npos) ? std::string::npos : (nextLine - curPos + 1);
+
+ hlslStream << "// " << mSource.substr(curPos, len);
+
+ curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1);
+ }
+ hlslStream << "\n\n";
+ hlslStream << outputHLSL;
+ mHlsl = hlslStream.str();
+#else
+ mHlsl = outputHLSL;
+#endif
+
+ delete[] outputHLSL;
+
</ins><span class="cx"> void *activeUniforms;
</span><span class="cx"> ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &activeUniforms);
</span><del>- mActiveUniforms = *(sh::ActiveUniforms*)activeUniforms;
</del><ins>+ mActiveUniforms = *(std::vector<Uniform>*)activeUniforms;
+
+ void *activeInterfaceBlocks;
+ ShGetInfoPointer(compiler, SH_ACTIVE_INTERFACE_BLOCKS_ARRAY, &activeInterfaceBlocks);
+ mActiveInterfaceBlocks = *(std::vector<InterfaceBlock>*)activeInterfaceBlocks;
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> size_t infoLogLen = 0;
</span><span class="cx"> ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen);
</span><del>- mInfoLog = new char[infoLogLen];
- ShGetInfoLog(compiler, mInfoLog);
</del><span class="cx">
</span><del>- TRACE("\n%s", mInfoLog);
</del><ins>+ char* infoLog = new char[infoLogLen];
+ ShGetInfoLog(compiler, infoLog);
+ mInfoLog = infoLog;
+
+ TRACE("\n%s", mInfoLog.c_str());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GLenum Shader::parseType(const std::string &type)
</del><ins>+rx::D3DWorkaroundType Shader::getD3DWorkarounds() const
</ins><span class="cx"> {
</span><del>- if (type == "float")
</del><ins>+ if (mUsesDiscardRewriting)
</ins><span class="cx"> {
</span><del>- return GL_FLOAT;
</del><ins>+ // 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;
</ins><span class="cx"> }
</span><del>- else if (type == "float2")
</del><ins>+
+ if (mUsesNestedBreak)
</ins><span class="cx"> {
</span><del>- return GL_FLOAT_VEC2;
</del><ins>+ // 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;
</ins><span class="cx"> }
</span><del>- else if (type == "float3")
- {
- return GL_FLOAT_VEC3;
- }
- else if (type == "float4")
- {
- return GL_FLOAT_VEC4;
- }
- else if (type == "float2x2")
- {
- return GL_FLOAT_MAT2;
- }
- else if (type == "float3x3")
- {
- return GL_FLOAT_MAT3;
- }
- else if (type == "float4x4")
- {
- return GL_FLOAT_MAT4;
- }
- else UNREACHABLE();
</del><span class="cx">
</span><del>- return GL_NONE;
</del><ins>+ return rx::ANGLE_D3D_WORKAROUND_NONE;
</ins><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
+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,
+};
+
</ins><span class="cx"> // true if varying x has a higher priority in packing than y
</span><del>-bool Shader::compareVarying(const Varying &x, const Varying &y)
</del><ins>+bool Shader::compareVarying(const ShaderVariable &x, const ShaderVariable &y)
</ins><span class="cx"> {
</span><del>- if(x.type == y.type)
</del><ins>+ if (x.type == y.type)
</ins><span class="cx"> {
</span><del>- return x.size > y.size;
</del><ins>+ return x.arraySize > y.arraySize;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- switch (x.type)
</del><ins>+ // Special case for handling structs: we sort these to the end of the list
+ if (x.type == GL_STRUCT_ANGLEX)
</ins><span class="cx"> {
</span><del>- case GL_FLOAT_MAT4: return true;
- case GL_FLOAT_MAT2:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return true;
- case GL_FLOAT_VEC4: return true;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_VEC4:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return true;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_MAT3:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_VEC3:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return false;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT_VEC2:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return false;
- case GL_FLOAT_VEC3: return false;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE();
- }
- break;
- case GL_FLOAT: return false;
- default: UNREACHABLE();
</del><ins>+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return false;
</del><ins>+ unsigned int xPriority = GL_INVALID_INDEX;
+ unsigned int yPriority = GL_INVALID_INDEX;
+
+ for (unsigned int priorityIndex = 0; priorityIndex < ArraySize(varyingPriorityList); priorityIndex++)
+ {
+ if (varyingPriorityList[priorityIndex] == x.type) xPriority = priorityIndex;
+ if (varyingPriorityList[priorityIndex] == y.type) yPriority = priorityIndex;
+ if (xPriority != GL_INVALID_INDEX && yPriority != GL_INVALID_INDEX) break;
+ }
+
+ ASSERT(xPriority != GL_INVALID_INDEX && yPriority != GL_INVALID_INDEX);
+
+ return xPriority <= yPriority;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+int Shader::getShaderVersion() const
+{
+ return mShaderVersion;
+}
+
</ins><span class="cx"> VertexShader::VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
</span><span class="cx"> : Shader(manager, renderer, handle)
</span><span class="cx"> {
</span><span class="lines">@@ -542,7 +492,7 @@
</span><span class="cx"> Shader::uncompile();
</span><span class="cx">
</span><span class="cx"> // set by ParseAttributes
</span><del>- mAttributes.clear();
</del><ins>+ mActiveAttributes.clear();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void VertexShader::compile()
</span><span class="lines">@@ -551,7 +501,7 @@
</span><span class="cx">
</span><span class="cx"> compileToHLSL(mVertexCompiler);
</span><span class="cx"> parseAttributes();
</span><del>- parseVaryings();
</del><ins>+ parseVaryings(mVertexCompiler);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int VertexShader::getSemanticIndex(const std::string &attributeName)
</span><span class="lines">@@ -559,14 +509,16 @@
</span><span class="cx"> if (!attributeName.empty())
</span><span class="cx"> {
</span><span class="cx"> int semanticIndex = 0;
</span><del>- for (AttributeArray::iterator attribute = mAttributes.begin(); attribute != mAttributes.end(); attribute++)
</del><ins>+ for (unsigned int attributeIndex = 0; attributeIndex < mActiveAttributes.size(); attributeIndex++)
</ins><span class="cx"> {
</span><del>- if (attribute->name == attributeName)
</del><ins>+ const ShaderVariable &attribute = mActiveAttributes[attributeIndex];
+
+ if (attribute.name == attributeName)
</ins><span class="cx"> {
</span><span class="cx"> return semanticIndex;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- semanticIndex += VariableRowCount(attribute->type);
</del><ins>+ semanticIndex += AttributeRegisterCount(attribute.type);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -575,27 +527,12 @@
</span><span class="cx">
</span><span class="cx"> void VertexShader::parseAttributes()
</span><span class="cx"> {
</span><del>- const char *hlsl = getHLSL();
- if (hlsl)
</del><ins>+ const std::string &hlsl = getHLSL();
+ if (!hlsl.empty())
</ins><span class="cx"> {
</span><del>- const char *input = strstr(hlsl, "// Attributes") + 14;
-
- while(true)
- {
- char attributeType[256];
- char attributeName[256];
-
- int matches = sscanf(input, "static %255s _%255s", attributeType, attributeName);
-
- if (matches != 2)
- {
- break;
- }
-
- mAttributes.push_back(Attribute(parseType(attributeType), attributeName));
-
- input = strstr(input, ";") + 2;
- }
</del><ins>+ void *activeAttributes;
+ ShGetInfoPointer(mVertexCompiler, SH_ACTIVE_ATTRIBUTES_ARRAY, &activeAttributes);
+ mActiveAttributes = *(std::vector<Attribute>*)activeAttributes;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -618,7 +555,28 @@
</span><span class="cx"> uncompile();
</span><span class="cx">
</span><span class="cx"> compileToHLSL(mFragmentCompiler);
</span><del>- parseVaryings();
- mVaryings.sort(compareVarying);
</del><ins>+ parseVaryings(mFragmentCompiler);
+ std::sort(mVaryings.begin(), mVaryings.end(), compareVarying);
+
+ const std::string &hlsl = getHLSL();
+ if (!hlsl.empty())
+ {
+ void *activeOutputVariables;
+ ShGetInfoPointer(mFragmentCompiler, SH_ACTIVE_OUTPUT_VARIABLES_ARRAY, &activeOutputVariables);
+ mActiveOutputVariables = *(std::vector<Attribute>*)activeOutputVariables;
+ }
</ins><span class="cx"> }
</span><ins>+
+void FragmentShader::uncompile()
+{
+ Shader::uncompile();
+
+ mActiveOutputVariables.clear();
</ins><span class="cx"> }
</span><ins>+
+const std::vector<Attribute> &FragmentShader::getOutputVariables() const
+{
+ return mActiveOutputVariables;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Shaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,13 +13,15 @@
</span><span class="cx"> #define LIBGLESV2_SHADER_H_
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx"> #include <string>
</span><span class="cx"> #include <list>
</span><span class="cx"> #include <vector>
</span><span class="cx">
</span><del>-#include "compiler/translator/Uniform.h"
</del><ins>+#include "common/shadervars.h"
</ins><span class="cx"> #include "common/angleutils.h"
</span><ins>+#include "libGLESv2/angletypes.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -30,27 +32,9 @@
</span><span class="cx"> {
</span><span class="cx"> class ResourceManager;
</span><span class="cx">
</span><del>-struct Varying
-{
- Varying(GLenum type, const std::string &name, int size, bool array)
- : type(type), name(name), size(size), array(array), reg(-1), col(-1)
- {
- }
-
- GLenum type;
- std::string name;
- int size; // Number of 'type' elements
- bool array;
-
- int reg; // First varying register, assigned during link
- int col; // First register element, assigned during link
-};
-
-typedef std::list<Varying> VaryingList;
-
</del><span class="cx"> class Shader
</span><span class="cx"> {
</span><del>- friend class ProgramBinary;
</del><ins>+ friend class DynamicHLSL;
</ins><span class="cx">
</span><span class="cx"> public:
</span><span class="cx"> Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle);
</span><span class="lines">@@ -61,42 +45,48 @@
</span><span class="cx"> GLuint getHandle() const;
</span><span class="cx">
</span><span class="cx"> void deleteSource();
</span><del>- void setSource(GLsizei count, const char **string, const GLint *length);
</del><ins>+ void setSource(GLsizei count, const char *const *string, const GLint *length);
</ins><span class="cx"> int getInfoLogLength() const;
</span><del>- void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
</del><ins>+ void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const;
</ins><span class="cx"> int getSourceLength() const;
</span><del>- void getSource(GLsizei bufSize, GLsizei *length, char *buffer);
</del><ins>+ void getSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
</ins><span class="cx"> int getTranslatedSourceLength() const;
</span><del>- void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer);
- const sh::ActiveUniforms &getUniforms();
</del><ins>+ void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
+ const std::vector<Uniform> &getUniforms() const;
+ const std::vector<InterfaceBlock> &getInterfaceBlocks() const;
+ std::vector<Varying> &getVaryings();
</ins><span class="cx">
</span><span class="cx"> virtual void compile() = 0;
</span><span class="cx"> virtual void uncompile();
</span><del>- bool isCompiled();
- const char *getHLSL();
</del><ins>+ bool isCompiled() const;
+ const std::string &getHLSL() const;
</ins><span class="cx">
</span><span class="cx"> void addRef();
</span><span class="cx"> void release();
</span><span class="cx"> unsigned int getRefCount() const;
</span><span class="cx"> bool isFlaggedForDeletion() const;
</span><span class="cx"> void flagForDeletion();
</span><ins>+ int getShaderVersion() const;
+ void resetVaryingsRegisterAssignment();
</ins><span class="cx">
</span><span class="cx"> static void releaseCompiler();
</span><span class="cx">
</span><ins>+ bool usesDepthRange() const { return mUsesDepthRange; }
+ bool usesPointSize() const { return mUsesPointSize; }
+ rx::D3DWorkaroundType getD3DWorkarounds() const;
+
</ins><span class="cx"> protected:
</span><del>- void parseVaryings();
- void resetVaryingsRegisterAssignment();
</del><ins>+ void parseVaryings(void *compiler);
</ins><span class="cx">
</span><span class="cx"> void compileToHLSL(void *compiler);
</span><span class="cx">
</span><del>- void getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char *buffer);
</del><ins>+ void getSourceImpl(const std::string &source, GLsizei bufSize, GLsizei *length, char *buffer) const;
</ins><span class="cx">
</span><del>- static GLenum parseType(const std::string &type);
- static bool compareVarying(const Varying &x, const Varying &y);
</del><ins>+ static bool compareVarying(const ShaderVariable &x, const ShaderVariable &y);
</ins><span class="cx">
</span><span class="cx"> const rx::Renderer *const mRenderer;
</span><span class="cx">
</span><del>- VaryingList mVaryings;
</del><ins>+ std::vector<Varying> mVaryings;
</ins><span class="cx">
</span><span class="cx"> bool mUsesMultipleRenderTargets;
</span><span class="cx"> bool mUsesFragColor;
</span><span class="lines">@@ -107,7 +97,9 @@
</span><span class="cx"> bool mUsesPointCoord;
</span><span class="cx"> bool mUsesDepthRange;
</span><span class="cx"> bool mUsesFragDepth;
</span><ins>+ int mShaderVersion;
</ins><span class="cx"> bool mUsesDiscardRewriting;
</span><ins>+ bool mUsesNestedBreak;
</ins><span class="cx">
</span><span class="cx"> static void *mFragmentCompiler;
</span><span class="cx"> static void *mVertexCompiler;
</span><span class="lines">@@ -121,33 +113,18 @@
</span><span class="cx"> unsigned int mRefCount; // Number of program objects this shader is attached to
</span><span class="cx"> bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use
</span><span class="cx">
</span><del>- char *mSource;
- char *mHlsl;
- char *mInfoLog;
- sh::ActiveUniforms mActiveUniforms;
</del><ins>+ std::string mSource;
+ std::string mHlsl;
+ std::string mInfoLog;
+ std::vector<Uniform> mActiveUniforms;
+ std::vector<InterfaceBlock> mActiveInterfaceBlocks;
</ins><span class="cx">
</span><span class="cx"> ResourceManager *mResourceManager;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-struct Attribute
-{
- Attribute() : type(GL_NONE), name("")
- {
- }
-
- Attribute(GLenum type, const std::string &name) : type(type), name(name)
- {
- }
-
- GLenum type;
- std::string name;
-};
-
-typedef std::vector<Attribute> AttributeArray;
-
</del><span class="cx"> class VertexShader : public Shader
</span><span class="cx"> {
</span><del>- friend class ProgramBinary;
</del><ins>+ friend class DynamicHLSL;
</ins><span class="cx">
</span><span class="cx"> public:
</span><span class="cx"> VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle);
</span><span class="lines">@@ -159,12 +136,14 @@
</span><span class="cx"> virtual void uncompile();
</span><span class="cx"> int getSemanticIndex(const std::string &attributeName);
</span><span class="cx">
</span><ins>+ const std::vector<Attribute> &activeAttributes() const { return mActiveAttributes; }
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(VertexShader);
</span><span class="cx">
</span><span class="cx"> void parseAttributes();
</span><span class="cx">
</span><del>- AttributeArray mAttributes;
</del><ins>+ std::vector<Attribute> mActiveAttributes;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class FragmentShader : public Shader
</span><span class="lines">@@ -176,9 +155,13 @@
</span><span class="cx">
</span><span class="cx"> virtual GLenum getType();
</span><span class="cx"> virtual void compile();
</span><ins>+ virtual void uncompile();
+ const std::vector<Attribute> &getOutputVariables() const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(FragmentShader);
</span><ins>+
+ std::vector<Attribute> mActiveOutputVariables;
</ins><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Texturecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,129 +12,176 @@
</span><span class="cx"> #include "libGLESv2/Texture.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/main.h"
</span><del>-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/utilities.h"
-#include "libGLESv2/renderer/d3d9/Blit.h"
</del><ins>+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
</ins><span class="cx"> #include "libGLESv2/Renderbuffer.h"
</span><span class="cx"> #include "libGLESv2/renderer/Image.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><span class="cx"> #include "libGLESv2/renderer/TextureStorage.h"
</span><span class="cx"> #include "libEGL/Surface.h"
</span><ins>+#include "libGLESv2/Buffer.h"
+#include "libGLESv2/renderer/BufferStorage.h"
+#include "libGLESv2/renderer/RenderTarget.h"
</ins><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx">
</span><del>-Texture::Texture(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
</del><ins>+bool IsMipmapFiltered(const SamplerState &samplerState)
</ins><span class="cx"> {
</span><ins>+ 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)
+{
</ins><span class="cx"> mRenderer = renderer;
</span><span class="cx">
</span><span class="cx"> mSamplerState.minFilter = GL_NEAREST_MIPMAP_LINEAR;
</span><span class="cx"> mSamplerState.magFilter = GL_LINEAR;
</span><span class="cx"> mSamplerState.wrapS = GL_REPEAT;
</span><span class="cx"> mSamplerState.wrapT = GL_REPEAT;
</span><ins>+ mSamplerState.wrapR = GL_REPEAT;
</ins><span class="cx"> mSamplerState.maxAnisotropy = 1.0f;
</span><del>- mSamplerState.lodOffset = 0;
</del><ins>+ 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;
</ins><span class="cx"> mUsage = GL_NONE;
</span><del>-
</del><ins>+
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx">
</span><span class="cx"> mImmutable = false;
</span><ins>+
+ mTarget = target;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Texture::~Texture()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMinFilter(GLenum filter)
</del><ins>+GLenum Texture::getTarget() const
</ins><span class="cx"> {
</span><del>- switch (filter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- mSamplerState.minFilter = filter;
- return true;
- default:
- return false;
- }
</del><ins>+ return mTarget;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMagFilter(GLenum filter)
</del><ins>+void Texture::addProxyRef(const Renderbuffer *proxy)
</ins><span class="cx"> {
</span><del>- switch (filter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- mSamplerState.magFilter = filter;
- return true;
- default:
- return false;
- }
</del><ins>+ mRenderbufferProxies.addRef(proxy);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapS(GLenum wrap)
</del><ins>+void Texture::releaseProxy(const Renderbuffer *proxy)
</ins><span class="cx"> {
</span><del>- switch (wrap)
- {
- case GL_REPEAT:
- case GL_CLAMP_TO_EDGE:
- case GL_MIRRORED_REPEAT:
- mSamplerState.wrapS = wrap;
- return true;
- default:
- return false;
- }
</del><ins>+ mRenderbufferProxies.release(proxy);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapT(GLenum wrap)
</del><ins>+void Texture::setMinFilter(GLenum filter)
</ins><span class="cx"> {
</span><del>- switch (wrap)
- {
- case GL_REPEAT:
- case GL_CLAMP_TO_EDGE:
- case GL_MIRRORED_REPEAT:
- mSamplerState.wrapT = wrap;
- return true;
- default:
- return false;
- }
</del><ins>+ mSamplerState.minFilter = filter;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Returns true on successful max anisotropy update (valid anisotropy value)
-bool Texture::setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy)
</del><ins>+void Texture::setMagFilter(GLenum filter)
</ins><span class="cx"> {
</span><del>- textureMaxAnisotropy = std::min(textureMaxAnisotropy, contextMaxAnisotropy);
- if (textureMaxAnisotropy < 1.0f)
- {
- return false;
- }
</del><ins>+ mSamplerState.magFilter = filter;
+}
</ins><span class="cx">
</span><del>- mSamplerState.maxAnisotropy = textureMaxAnisotropy;
</del><ins>+void Texture::setWrapS(GLenum wrap)
+{
+ mSamplerState.wrapS = wrap;
+}
</ins><span class="cx">
</span><del>- return true;
</del><ins>+void Texture::setWrapT(GLenum wrap)
+{
+ mSamplerState.wrapT = wrap;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Returns true on successful usage state update (valid enum parameter)
-bool Texture::setUsage(GLenum usage)
</del><ins>+void Texture::setWrapR(GLenum wrap)
</ins><span class="cx"> {
</span><del>- switch (usage)
- {
- case GL_NONE:
- case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
- mUsage = usage;
- return true;
- default:
- return false;
- }
</del><ins>+ mSamplerState.wrapR = wrap;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> GLenum Texture::getMinFilter() const
</span><span class="cx"> {
</span><span class="cx"> return mSamplerState.minFilter;
</span><span class="lines">@@ -155,21 +202,72 @@
</span><span class="cx"> return mSamplerState.wrapT;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLenum Texture::getWrapR() const
+{
+ return mSamplerState.wrapR;
+}
+
</ins><span class="cx"> float Texture::getMaxAnisotropy() const
</span><span class="cx"> {
</span><span class="cx"> return mSamplerState.maxAnisotropy;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-int Texture::getLodOffset()
</del><ins>+GLenum Texture::getSwizzleRed() const
</ins><span class="cx"> {
</span><del>- rx::TextureStorageInterface *texture = getStorage(false);
- return texture ? texture->getLodOffset() : 0;
</del><ins>+ return mSamplerState.swizzleRed;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> void Texture::getSamplerState(SamplerState *sampler)
</span><span class="cx"> {
</span><span class="cx"> *sampler = mSamplerState;
</span><del>- sampler->lodOffset = getLodOffset();
</del><ins>+
+ // Offset the effective base level by the texture storage's top level
+ rx::TextureStorageInterface *texture = getNativeTexture();
+ int topLevel = texture ? texture->getTopLevel() : 0;
+ sampler->baseLevel = topLevel + mSamplerState.baseLevel;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GLenum Texture::getUsage() const
</span><span class="lines">@@ -177,57 +275,121 @@
</span><span class="cx"> return mUsage;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Texture::isMipmapFiltered() const
</del><ins>+GLint Texture::getBaseLevelWidth() const
</ins><span class="cx"> {
</span><del>- switch (mSamplerState.minFilter)
</del><ins>+ const rx::Image *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getWidth() : 0);
+}
+
+GLint Texture::getBaseLevelHeight() const
+{
+ const rx::Image *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getHeight() : 0);
+}
+
+GLint Texture::getBaseLevelDepth() const
+{
+ const rx::Image *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getDepth() : 0);
+}
+
+// Note: "base level image" 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->getInternalFormat() : GL_NONE);
+}
+
+void Texture::setImage(const PixelUnpackState &unpack, GLenum type, const void *pixels, rx::Image *image)
+{
+ // No-op
+ if (image->getWidth() == 0 || image->getHeight() == 0 || image->getDepth() == 0)
</ins><span class="cx"> {
</span><del>- 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;
</del><ins>+ return;
</ins><span class="cx"> }
</span><ins>+
+ // We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
+ // From our image internal format we know how many channels to expect, and "type" 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<ptrdiff_t>(pixels);
+ const void *bufferData = pixelBuffer->getStorage()->getData();
+ pixelData = static_cast<const unsigned char *>(bufferData) + offset;
+ }
+
+ if (pixelData != NULL)
+ {
+ image->loadData(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth(), unpack.alignment, type, pixelData);
+ mDirtyImages = true;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Texture::setImage(GLint unpackAlignment, const void *pixels, rx::Image *image)
</del><ins>+bool Texture::isFastUnpackable(const PixelUnpackState &unpack, GLenum sizedInternalFormat)
</ins><span class="cx"> {
</span><del>- if (pixels != NULL)
</del><ins>+ return unpack.pixelBuffer.id() != 0 && mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat);
+}
+
+bool Texture::fastUnpackPixels(const PixelUnpackState &unpack, const void *pixels, const Box &destArea,
+ GLenum sizedInternalFormat, GLenum type, rx::RenderTarget *destRenderTarget)
+{
+ if (destArea.width <= 0 && destArea.height <= 0 && destArea.depth <= 0)
</ins><span class="cx"> {
</span><del>- image->loadData(0, 0, image->getWidth(), image->getHeight(), unpackAlignment, pixels);
- mDirtyImages = true;
</del><ins>+ return true;
</ins><span class="cx"> }
</span><ins>+
+ // 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->supportsFastCopyBufferToTexture(sizedInternalFormat));
+
+ unsigned int offset = reinterpret_cast<unsigned int>(pixels);
+
+ return mRenderer->fastCopyBufferToTexture(unpack, offset, destRenderTarget, sizedInternalFormat, type, destArea);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image)
</span><span class="cx"> {
</span><span class="cx"> if (pixels != NULL)
</span><span class="cx"> {
</span><del>- image->loadCompressedData(0, 0, image->getWidth(), image->getHeight(), pixels);
</del><ins>+ image->loadCompressedData(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth(), pixels);
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Texture::subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, rx::Image *image)
</del><ins>+bool Texture::subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels, rx::Image *image)
</ins><span class="cx"> {
</span><del>- if (pixels != NULL)
</del><ins>+ const void *pixelData = pixels;
+
+ // CPU readback & copy where direct GPU copy is not supported
+ if (unpack.pixelBuffer.id() != 0)
</ins><span class="cx"> {
</span><del>- image->loadData(xoffset, yoffset, width, height, unpackAlignment, pixels);
</del><ins>+ Buffer *pixelBuffer = unpack.pixelBuffer.get();
+ unsigned int offset = reinterpret_cast<unsigned int>(pixels);
+ const void *bufferData = pixelBuffer->getStorage()->getData();
+ pixelData = static_cast<const unsigned char *>(bufferData) + offset;
+ }
+
+ if (pixelData != NULL)
+ {
+ image->loadData(xoffset, yoffset, zoffset, width, height, depth, unpack.alignment, type, pixelData);
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image)
</del><ins>+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)
</ins><span class="cx"> {
</span><span class="cx"> if (pixels != NULL)
</span><span class="cx"> {
</span><del>- image->loadCompressedData(xoffset, yoffset, width, height, pixels);
</del><ins>+ image->loadCompressedData(xoffset, yoffset, zoffset, width, height, depth, pixels);
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -237,11 +399,12 @@
</span><span class="cx"> rx::TextureStorageInterface *Texture::getNativeTexture()
</span><span class="cx"> {
</span><span class="cx"> // ensure the underlying texture is created
</span><ins>+ initializeStorage(false);
</ins><span class="cx">
</span><del>- rx::TextureStorageInterface *storage = getStorage(false);
</del><ins>+ rx::TextureStorageInterface *storage = getBaseLevelStorage();
</ins><span class="cx"> if (storage)
</span><span class="cx"> {
</span><del>- updateTexture();
</del><ins>+ updateStorage();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return storage;
</span><span class="lines">@@ -259,26 +422,26 @@
</span><span class="cx">
</span><span class="cx"> unsigned int Texture::getTextureSerial()
</span><span class="cx"> {
</span><del>- rx::TextureStorageInterface *texture = getStorage(false);
</del><ins>+ rx::TextureStorageInterface *texture = getNativeTexture();
</ins><span class="cx"> return texture ? texture->getTextureSerial() : 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int Texture::getRenderTargetSerial(GLenum target)
</del><ins>+bool Texture::isImmutable() const
</ins><span class="cx"> {
</span><del>- rx::TextureStorageInterface *texture = getStorage(true);
- return texture ? texture->getRenderTargetSerial(target) : 0;
</del><ins>+ return mImmutable;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Texture::isImmutable() const
</del><ins>+int Texture::immutableLevelCount()
</ins><span class="cx"> {
</span><del>- return mImmutable;
</del><ins>+ return (mImmutable ? getNativeTexture()->getStorageInstance()->getLevelCount() : 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-GLint Texture::creationLevels(GLsizei width, GLsizei height) const
</del><ins>+GLint Texture::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
</ins><span class="cx"> {
</span><del>- if ((isPow2(width) && isPow2(height)) || mRenderer->getNonPower2TextureSupport())
</del><ins>+ if ((isPow2(width) && isPow2(height) && isPow2(depth)) || mRenderer->getNonPower2TextureSupport())
</ins><span class="cx"> {
</span><del>- return 0; // Maximum number of levels
</del><ins>+ // Maximum number of levels
+ return log2(std::max(std::max(width, height), depth)) + 1;
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -287,17 +450,15 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GLint Texture::creationLevels(GLsizei size) const
</del><ins>+int Texture::mipLevels() const
</ins><span class="cx"> {
</span><del>- return creationLevels(size, size);
</del><ins>+ return log2(std::max(std::max(getBaseLevelWidth(), getBaseLevelHeight()), getBaseLevelDepth())) + 1;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Texture2D::Texture2D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id)
</del><ins>+Texture2D::Texture2D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_2D)
</ins><span class="cx"> {
</span><span class="cx"> mTexStorage = NULL;
</span><span class="cx"> mSurface = NULL;
</span><del>- mColorbufferProxy = NULL;
- mProxyRefs = 0;
</del><span class="cx">
</span><span class="cx"> for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
</span><span class="cx"> {
</span><span class="lines">@@ -307,8 +468,6 @@
</span><span class="cx">
</span><span class="cx"> Texture2D::~Texture2D()
</span><span class="cx"> {
</span><del>- mColorbufferProxy = NULL;
-
</del><span class="cx"> delete mTexStorage;
</span><span class="cx"> mTexStorage = NULL;
</span><span class="cx">
</span><span class="lines">@@ -324,28 +483,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// We need to maintain a count of references to renderbuffers acting as
-// proxies for this texture, so that we do not attempt to use a pointer
-// to a renderbuffer proxy which has been deleted.
-void Texture2D::addProxyRef(const Renderbuffer *proxy)
-{
- mProxyRefs++;
-}
-
-void Texture2D::releaseProxy(const Renderbuffer *proxy)
-{
- if (mProxyRefs > 0)
- mProxyRefs--;
-
- if (mProxyRefs == 0)
- mColorbufferProxy = NULL;
-}
-
-GLenum Texture2D::getTarget() const
-{
- return GL_TEXTURE_2D;
-}
-
</del><span class="cx"> GLsizei Texture2D::getWidth(GLint level) const
</span><span class="cx"> {
</span><span class="cx"> if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
</span><span class="lines">@@ -375,24 +512,24 @@
</span><span class="cx"> if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
</span><span class="cx"> return mImageArray[level]->getActualFormat();
</span><span class="cx"> else
</span><del>- return D3DFMT_UNKNOWN;
</del><ins>+ return GL_NONE;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Texture2D::redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height)
</del><ins>+void Texture2D::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><span class="cx"> releaseTexImage();
</span><span class="cx">
</span><span class="cx"> // If there currently is a corresponding storage texture image, it has these parameters
</span><del>- const int storageWidth = std::max(1, mImageArray[0]->getWidth() >> level);
- const int storageHeight = std::max(1, mImageArray[0]->getHeight() >> level);
- const int storageFormat = mImageArray[0]->getInternalFormat();
</del><ins>+ const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
</ins><span class="cx">
</span><del>- mImageArray[level]->redefine(mRenderer, internalformat, width, height, false);
</del><ins>+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, width, height, 1, false);
</ins><span class="cx">
</span><span class="cx"> if (mTexStorage)
</span><span class="cx"> {
</span><del>- const int storageLevels = mTexStorage->levelCount();
-
</del><ins>+ const int storageLevels = mTexStorage->getLevelCount();
+
</ins><span class="cx"> if ((level >= storageLevels && storageLevels != 0) ||
</span><span class="cx"> width != storageWidth ||
</span><span class="cx"> height != storageHeight ||
</span><span class="lines">@@ -410,21 +547,44 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- GLint internalformat = ConvertSizedInternalFormat(format, type);
- redefineImage(level, internalformat, width, height);
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+ : GetSizedInternalFormat(format, type, clientVersion);
+ redefineImage(level, sizedInternalFormat, width, height);
</ins><span class="cx">
</span><del>- Texture::setImage(unpackAlignment, pixels, mImageArray[level]);
</del><ins>+ bool fastUnpacked = false;
+
+ // Attempt a fast gpu copy of the pixel data to the surface
+ if (isFastUnpackable(unpack, sizedInternalFormat) && 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 && fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget))
+ {
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
+ }
+ }
+
+ if (!fastUnpacked)
+ {
+ Texture::setImage(unpack, type, pixels, mImageArray[level]);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Texture2D::bindTexImage(egl::Surface *surface)
</span><span class="cx"> {
</span><span class="cx"> releaseTexImage();
</span><span class="cx">
</span><del>- GLint internalformat = surface->getFormat();
</del><ins>+ GLenum internalformat = surface->getFormat();
</ins><span class="cx">
</span><del>- mImageArray[0]->redefine(mRenderer, internalformat, surface->getWidth(), surface->getHeight(), true);
</del><ins>+ mImageArray[0]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, surface->getWidth(), surface->getHeight(), 1, true);
</ins><span class="cx">
</span><span class="cx"> delete mTexStorage;
</span><span class="cx"> mTexStorage = new rx::TextureStorageInterface2D(mRenderer, surface->getSwapChain());
</span><span class="lines">@@ -449,7 +609,7 @@
</span><span class="cx">
</span><span class="cx"> for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
</span><span class="cx"> {
</span><del>- mImageArray[i]->redefine(mRenderer, GL_NONE, 0, 0, true);
</del><ins>+ mImageArray[i]->redefine(mRenderer, GL_TEXTURE_2D, GL_NONE, 0, 0, 0, true);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -464,27 +624,43 @@
</span><span class="cx">
</span><span class="cx"> void Texture2D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</span><span class="cx"> {
</span><del>- if (level < levelCount())
</del><ins>+ if (isValidLevel(level))
</ins><span class="cx"> {
</span><span class="cx"> rx::Image *image = mImageArray[level];
</span><del>- if (image->updateSurface(mTexStorage, level, xoffset, yoffset, width, height))
</del><ins>+ if (image->copyToStorage(mTexStorage, level, xoffset, yoffset, width, height))
</ins><span class="cx"> {
</span><span class="cx"> image->markClean();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, mImageArray[level]))
</del><ins>+ bool fastUnpacked = false;
+
+ if (isFastUnpackable(unpack, getInternalFormat(level)) && isLevelComplete(level))
</ins><span class="cx"> {
</span><ins>+ rx::RenderTarget *renderTarget = getRenderTarget(level);
+ Box destArea(xoffset, yoffset, 0, width, height, 1);
+
+ if (renderTarget && fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, renderTarget))
+ {
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
+ }
+ }
+
+ if (!fastUnpacked && Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, pixels, mImageArray[level]))
+ {
</ins><span class="cx"> commitRect(level, xoffset, yoffset, width, height);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
</span><span class="cx"> {
</span><del>- if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, mImageArray[level]))
</del><ins>+ if (Texture::subImageCompressed(xoffset, yoffset, 0, width, height, 1, format, imageSize, pixels, mImageArray[level]))
</ins><span class="cx"> {
</span><span class="cx"> commitRect(level, xoffset, yoffset, width, height);
</span><span class="cx"> }
</span><span class="lines">@@ -492,24 +668,22 @@
</span><span class="cx">
</span><span class="cx"> void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
</span><span class="cx"> {
</span><del>- GLint internalformat = ConvertSizedInternalFormat(format, GL_UNSIGNED_BYTE);
- redefineImage(level, internalformat, width, height);
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
+ : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
+ redefineImage(level, sizedInternalFormat, width, height);
</ins><span class="cx">
</span><span class="cx"> if (!mImageArray[level]->isRenderableFormat())
</span><span class="cx"> {
</span><del>- mImageArray[level]->copy(0, 0, x, y, width, height, source);
</del><ins>+ mImageArray[level]->copy(0, 0, 0, x, y, width, height, source);
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- if (!mTexStorage || !mTexStorage->isRenderTarget())
- {
- convertToRenderTarget();
- }
-
</del><ins>+ ensureRenderTarget();
</ins><span class="cx"> mImageArray[level]->markClean();
</span><span class="cx">
</span><del>- if (width != 0 && height != 0 && level < levelCount())
</del><ins>+ if (width != 0 && height != 0 && isValidLevel(level))
</ins><span class="cx"> {
</span><span class="cx"> gl::Rectangle sourceRect;
</span><span class="cx"> sourceRect.x = x;
</span><span class="lines">@@ -522,37 +696,40 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
</del><ins>+void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
</ins><span class="cx"> {
</span><del>- if (xoffset + width > mImageArray[level]->getWidth() || yoffset + height > mImageArray[level]->getHeight())
</del><ins>+ if (xoffset + width > mImageArray[level]->getWidth() || yoffset + height > mImageArray[level]->getHeight() || zoffset != 0)
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
</del><ins>+ // can only make our texture storage to a render target if level 0 is defined (with a width & height) and
+ // the current level we're copying to is defined (with appropriate format, width & height)
+ bool canCreateRenderTarget = isLevelComplete(level) && isLevelComplete(0);
+
+ if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
</ins><span class="cx"> {
</span><del>- mImageArray[level]->copy(xoffset, yoffset, x, y, width, height, source);
</del><ins>+ mImageArray[level]->copy(xoffset, yoffset, 0, x, y, width, height, source);
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- if (!mTexStorage || !mTexStorage->isRenderTarget())
</del><ins>+ ensureRenderTarget();
+
+ if (isValidLevel(level))
</ins><span class="cx"> {
</span><del>- convertToRenderTarget();
- }
-
- updateTexture();
</del><ins>+ updateStorageLevel(level);
</ins><span class="cx">
</span><del>- if (level < levelCount())
- {
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
</ins><span class="cx"> gl::Rectangle sourceRect;
</span><span class="cx"> sourceRect.x = x;
</span><span class="cx"> sourceRect.width = width;
</span><span class="cx"> sourceRect.y = y;
</span><span class="cx"> sourceRect.height = height;
</span><span class="cx">
</span><del>- mRenderer->copyImage(source, sourceRect,
- gl::ExtractFormat(mImageArray[0]->getInternalFormat()),
</del><ins>+ mRenderer->copyImage(source, sourceRect,
+ gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
</ins><span class="cx"> xoffset, yoffset, mTexStorage, level);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -560,52 +737,54 @@
</span><span class="cx">
</span><span class="cx"> void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
</span><span class="cx"> {
</span><del>- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, mUsage, false, width, height);
- mImmutable = true;
-
</del><span class="cx"> for (int level = 0; level < levels; level++)
</span><span class="cx"> {
</span><del>- mImageArray[level]->redefine(mRenderer, internalformat, width, height, true);
- width = std::max(1, width >> 1);
- height = std::max(1, height >> 1);
</del><ins>+ GLsizei levelWidth = std::max(1, width >> level);
+ GLsizei levelHeight = std::max(1, height >> level);
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, levelWidth, levelHeight, 1, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
</span><span class="cx"> {
</span><del>- mImageArray[level]->redefine(mRenderer, GL_NONE, 0, 0, true);
</del><ins>+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_2D, GL_NONE, 0, 0, 0, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (mTexStorage->isManaged())
</del><ins>+ 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 && mTexStorage->isManaged())
</ins><span class="cx"> {
</span><del>- int levels = levelCount();
-
- for (int level = 0; level < levels; level++)
</del><ins>+ for (int level = 0; level < mTexStorage->getLevelCount(); level++)
</ins><span class="cx"> {
</span><span class="cx"> mImageArray[level]->setManagedSurface(mTexStorage, level);
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+ mDirtyImages = true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.
</span><del>-bool Texture2D::isSamplerComplete() const
</del><ins>+bool Texture2D::isSamplerComplete(const SamplerState &samplerState) const
</ins><span class="cx"> {
</span><del>- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
</del><ins>+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
</ins><span class="cx">
</span><span class="cx"> if (width <= 0 || height <= 0)
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool mipmapping = isMipmapFiltered();
- bool filtering, renderable;
-
- if ((IsFloat32Format(getInternalFormat(0)) && !mRenderer->getFloat32TextureSupport(&filtering, &renderable)) ||
- (IsFloat16Format(getInternalFormat(0)) && !mRenderer->getFloat16TextureSupport(&filtering, &renderable)))
</del><ins>+ if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
</ins><span class="cx"> {
</span><del>- if (mSamplerState.magFilter != GL_NEAREST ||
- (mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
</del><ins>+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -615,14 +794,14 @@
</span><span class="cx">
</span><span class="cx"> if (!npotSupport)
</span><span class="cx"> {
</span><del>- if ((mSamplerState.wrapS != GL_CLAMP_TO_EDGE && !isPow2(width)) ||
- (mSamplerState.wrapT != GL_CLAMP_TO_EDGE && !isPow2(height)))
</del><ins>+ if ((samplerState.wrapS != GL_CLAMP_TO_EDGE && !isPow2(width)) ||
+ (samplerState.wrapT != GL_CLAMP_TO_EDGE && !isPow2(height)))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mipmapping)
</del><ins>+ if (IsMipmapFiltered(samplerState))
</ins><span class="cx"> {
</span><span class="cx"> if (!npotSupport)
</span><span class="cx"> {
</span><span class="lines">@@ -638,43 +817,82 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // 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->getCurrentClientVersion()) > 0 &&
+ mRenderer->getCurrentClientVersion() > 2)
+ {
+ if (mSamplerState.compareMode == GL_NONE)
+ {
+ if ((mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST) ||
+ mSamplerState.magFilter != GL_NEAREST)
+ {
+ return false;
+ }
+ }
+ }
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Tests for 2D texture (mipmap) completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
</span><span class="cx"> bool Texture2D::isMipmapComplete() const
</span><span class="cx"> {
</span><ins>+ int levelCount = mipLevels();
+
+ for (int level = 0; level < levelCount; level++)
+ {
+ if (!isLevelComplete(level))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Texture2D::isLevelComplete(int level) const
+{
</ins><span class="cx"> if (isImmutable())
</span><span class="cx"> {
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
</del><ins>+ const rx::Image *baseImage = getBaseLevelImage();
</ins><span class="cx">
</span><ins>+ GLsizei width = baseImage->getWidth();
+ GLsizei height = baseImage->getHeight();
+
</ins><span class="cx"> if (width <= 0 || height <= 0)
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- int q = log2(std::max(width, height));
</del><ins>+ // The base image level is complete if the width and height are positive
+ if (level == 0)
+ {
+ return true;
+ }
</ins><span class="cx">
</span><del>- for (int level = 1; level <= q; level++)
</del><ins>+ ASSERT(level >= 1 && level <= (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+ rx::Image *image = mImageArray[level];
+
+ if (image->getInternalFormat() != baseImage->getInternalFormat())
</ins><span class="cx"> {
</span><del>- if (mImageArray[level]->getInternalFormat() != mImageArray[0]->getInternalFormat())
- {
- return false;
- }
</del><ins>+ return false;
+ }
</ins><span class="cx">
</span><del>- if (mImageArray[level]->getWidth() != std::max(1, width >> level))
- {
- return false;
- }
</del><ins>+ if (image->getWidth() != std::max(1, width >> level))
+ {
+ return false;
+ }
</ins><span class="cx">
</span><del>- if (mImageArray[level]->getHeight() != std::max(1, height >> level))
- {
- return false;
- }
</del><ins>+ if (image->getHeight() != std::max(1, height >> level))
+ {
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="lines">@@ -682,211 +900,201 @@
</span><span class="cx">
</span><span class="cx"> bool Texture2D::isCompressed(GLint level) const
</span><span class="cx"> {
</span><del>- return IsCompressed(getInternalFormat(level));
</del><ins>+ return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Texture2D::isDepth(GLint level) const
</span><span class="cx"> {
</span><del>- return IsDepthTexture(getInternalFormat(level));
</del><ins>+ return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Constructs a native texture resource from the texture images
</span><del>-void Texture2D::createTexture()
</del><ins>+void Texture2D::initializeStorage(bool renderTarget)
</ins><span class="cx"> {
</span><del>- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
</del><ins>+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return;
+ }
</ins><span class="cx">
</span><del>- if (!(width > 0 && height > 0))
- return; // do not attempt to create native textures for nonexistant data
</del><ins>+ // do not attempt to create storage for nonexistant data
+ if (!isLevelComplete(0))
+ {
+ return;
+ }
</ins><span class="cx">
</span><del>- GLint levels = creationLevels(width, height);
- GLenum internalformat = mImageArray[0]->getInternalFormat();
</del><ins>+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
</ins><span class="cx">
</span><del>- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, mUsage, false, width, height);
-
- if (mTexStorage->isManaged())
- {
- int levels = levelCount();
</del><ins>+ setCompleteTexStorage(createCompleteStorage(createRenderTarget));
+ ASSERT(mTexStorage);
</ins><span class="cx">
</span><del>- for (int level = 0; level < levels; level++)
- {
- mImageArray[level]->setManagedSurface(mTexStorage, level);
- }
- }
-
- mDirtyImages = true;
</del><ins>+ // flush image data to the storage
+ updateStorage();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Texture2D::updateTexture()
</del><ins>+rx::TextureStorageInterface2D *Texture2D::createCompleteStorage(bool renderTarget) const
</ins><span class="cx"> {
</span><del>- bool mipmapping = (isMipmapFiltered() && isMipmapComplete());
</del><ins>+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
</ins><span class="cx">
</span><del>- int levels = (mipmapping ? levelCount() : 1);
</del><ins>+ ASSERT(width > 0 && height > 0);
</ins><span class="cx">
</span><del>- for (int level = 0; level < levels; level++)
</del><ins>+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, 1));
+
+ return new rx::TextureStorageInterface2D(mRenderer, getBaseLevelInternalFormat(), renderTarget, width, height, levels);
+}
+
+void Texture2D::updateStorage()
+{
+ for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
</ins><span class="cx"> {
</span><del>- rx::Image *image = mImageArray[level];
-
- if (image->isDirty())
</del><ins>+ if (mImageArray[level]->isDirty() && isLevelComplete(level))
</ins><span class="cx"> {
</span><del>- commitRect(level, 0, 0, mImageArray[level]->getWidth(), mImageArray[level]->getHeight());
</del><ins>+ updateStorageLevel(level);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Texture2D::convertToRenderTarget()
</del><ins>+void Texture2D::updateStorageLevel(int level)
</ins><span class="cx"> {
</span><del>- rx::TextureStorageInterface2D *newTexStorage = NULL;
</del><ins>+ ASSERT(level <= (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+ ASSERT(isLevelComplete(level));
</ins><span class="cx">
</span><del>- if (mImageArray[0]->getWidth() != 0 && mImageArray[0]->getHeight() != 0)
</del><ins>+ if (mImageArray[level]->isDirty())
</ins><span class="cx"> {
</span><del>- GLsizei width = mImageArray[0]->getWidth();
- GLsizei height = mImageArray[0]->getHeight();
- GLint levels = mTexStorage != NULL ? mTexStorage->levelCount() : creationLevels(width, height);
- GLenum internalformat = mImageArray[0]->getInternalFormat();
</del><ins>+ commitRect(level, 0, 0, getWidth(level), getHeight(level));
+ }
+}
</ins><span class="cx">
</span><del>- newTexStorage = new rx::TextureStorageInterface2D(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, width, height);
</del><ins>+bool Texture2D::ensureRenderTarget()
+{
+ initializeStorage(true);
</ins><span class="cx">
</span><del>- if (mTexStorage != NULL)
</del><ins>+ if (getBaseLevelWidth() > 0 && getBaseLevelHeight() > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
</ins><span class="cx"> {
</span><del>- if (!mRenderer->copyToRenderTarget(newTexStorage, mTexStorage))
- {
- delete newTexStorage;
- return gl::error(GL_OUT_OF_MEMORY);
</del><ins>+ rx::TextureStorageInterface2D *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
+ {
+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
</ins><span class="cx"> }
</span><ins>+
+ setCompleteTexStorage(newRenderTargetStorage);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- delete mTexStorage;
- mTexStorage = newTexStorage;
-
- mDirtyImages = true;
</del><ins>+ return (mTexStorage && mTexStorage->isRenderTarget());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Texture2D::generateMipmaps()
</span><span class="cx"> {
</span><del>- if (!mRenderer->getNonPower2TextureSupport())
- {
- if (!isPow2(mImageArray[0]->getWidth()) || !isPow2(mImageArray[0]->getHeight()))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- }
-
</del><span class="cx"> // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
</span><del>- unsigned int q = log2(std::max(mImageArray[0]->getWidth(), mImageArray[0]->getHeight()));
- for (unsigned int i = 1; i <= q; i++)
</del><ins>+ int levelCount = mipLevels();
+ for (int level = 1; level < levelCount; level++)
</ins><span class="cx"> {
</span><del>- redefineImage(i, mImageArray[0]->getInternalFormat(),
- std::max(mImageArray[0]->getWidth() >> i, 1),
- std::max(mImageArray[0]->getHeight() >> i, 1));
</del><ins>+ redefineImage(level, getBaseLevelInternalFormat(),
+ std::max(getBaseLevelWidth() >> level, 1),
+ std::max(getBaseLevelHeight() >> level, 1));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (mTexStorage && mTexStorage->isRenderTarget())
</span><span class="cx"> {
</span><del>- for (unsigned int i = 1; i <= q; i++)
</del><ins>+ for (int level = 1; level < levelCount; level++)
</ins><span class="cx"> {
</span><del>- mTexStorage->generateMipmap(i);
</del><ins>+ mTexStorage->generateMipmap(level);
</ins><span class="cx">
</span><del>- mImageArray[i]->markClean();
</del><ins>+ mImageArray[level]->markClean();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- for (unsigned int i = 1; i <= q; i++)
</del><ins>+ for (int level = 1; level < levelCount; level++)
</ins><span class="cx"> {
</span><del>- mRenderer->generateMipmap(mImageArray[i], mImageArray[i - 1]);
</del><ins>+ mRenderer->generateMipmap(mImageArray[level], mImageArray[level - 1]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Renderbuffer *Texture2D::getRenderbuffer(GLenum target)
</del><ins>+const rx::Image *Texture2D::getBaseLevelImage() const
</ins><span class="cx"> {
</span><del>- if (target != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
- }
</del><ins>+ return mImageArray[0];
+}
</ins><span class="cx">
</span><del>- if (mColorbufferProxy == NULL)
</del><ins>+rx::TextureStorageInterface *Texture2D::getBaseLevelStorage()
+{
+ return mTexStorage;
+}
+
+Renderbuffer *Texture2D::getRenderbuffer(GLint level)
+{
+ Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, 0);
+ if (!renderBuffer)
</ins><span class="cx"> {
</span><del>- mColorbufferProxy = new Renderbuffer(mRenderer, id(), new RenderbufferTexture2D(this, target));
</del><ins>+ renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTexture2D(this, level));
+ mRenderbufferProxies.add(level, 0, renderBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return mColorbufferProxy;
</del><ins>+ return renderBuffer;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-rx::RenderTarget *Texture2D::getRenderTarget(GLenum target)
</del><ins>+unsigned int Texture2D::getRenderTargetSerial(GLint level)
</ins><span class="cx"> {
</span><del>- ASSERT(target == GL_TEXTURE_2D);
</del><ins>+ return (ensureRenderTarget() ? mTexStorage->getRenderTargetSerial(level) : 0);
+}
</ins><span class="cx">
</span><ins>+rx::RenderTarget *Texture2D::getRenderTarget(GLint level)
+{
</ins><span class="cx"> // ensure the underlying texture is created
</span><del>- if (getStorage(true) == NULL)
</del><ins>+ if (!ensureRenderTarget())
</ins><span class="cx"> {
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateTexture();
-
</del><ins>+ updateStorageLevel(level);
+
</ins><span class="cx"> // ensure this is NOT a depth texture
</span><del>- if (isDepth(0))
</del><ins>+ if (isDepth(level))
</ins><span class="cx"> {
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return mTexStorage->getRenderTarget();
</del><ins>+ return mTexStorage->getRenderTarget(level);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-rx::RenderTarget *Texture2D::getDepthStencil(GLenum target)
</del><ins>+rx::RenderTarget *Texture2D::getDepthSencil(GLint level)
</ins><span class="cx"> {
</span><del>- ASSERT(target == GL_TEXTURE_2D);
-
</del><span class="cx"> // ensure the underlying texture is created
</span><del>- if (getStorage(true) == NULL)
</del><ins>+ if (!ensureRenderTarget())
</ins><span class="cx"> {
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateTexture();
</del><ins>+ updateStorageLevel(level);
</ins><span class="cx">
</span><span class="cx"> // ensure this is actually a depth texture
</span><del>- if (!isDepth(0))
</del><ins>+ if (!isDepth(level))
</ins><span class="cx"> {
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><del>- return mTexStorage->getRenderTarget();
-}
</del><span class="cx">
</span><del>-int Texture2D::levelCount()
-{
- return mTexStorage ? mTexStorage->levelCount() : 0;
</del><ins>+ return mTexStorage->getRenderTarget(level);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-rx::TextureStorageInterface *Texture2D::getStorage(bool renderTarget)
</del><ins>+bool Texture2D::isValidLevel(int level) const
</ins><span class="cx"> {
</span><del>- if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
- {
- if (renderTarget)
- {
- convertToRenderTarget();
- }
- else
- {
- createTexture();
- }
- }
-
- return mTexStorage;
</del><ins>+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : false);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-TextureCubeMap::TextureCubeMap(rx::Renderer *renderer, GLuint id) : Texture(renderer, id)
</del><ins>+TextureCubeMap::TextureCubeMap(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_CUBE_MAP)
</ins><span class="cx"> {
</span><span class="cx"> mTexStorage = NULL;
</span><span class="cx"> for (int i = 0; i < 6; i++)
</span><span class="cx"> {
</span><del>- mFaceProxies[i] = NULL;
- mFaceProxyRefs[i] = 0;
-
</del><span class="cx"> for (int j = 0; j < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
</span><span class="cx"> {
</span><span class="cx"> mImageArray[i][j] = renderer->createImage();
</span><span class="lines">@@ -898,8 +1106,6 @@
</span><span class="cx"> {
</span><span class="cx"> for (int i = 0; i < 6; i++)
</span><span class="cx"> {
</span><del>- mFaceProxies[i] = NULL;
-
</del><span class="cx"> for (int j = 0; j < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
</span><span class="cx"> {
</span><span class="cx"> delete mImageArray[i][j];
</span><span class="lines">@@ -910,44 +1116,10 @@
</span><span class="cx"> mTexStorage = NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// We need to maintain a count of references to renderbuffers acting as
-// proxies for this texture, so that the texture is not deleted while
-// proxy references still exist. If the reference count drops to zero,
-// we set our proxy pointer NULL, so that a new attempt at referencing
-// will cause recreation.
-void TextureCubeMap::addProxyRef(const Renderbuffer *proxy)
-{
- for (int i = 0; i < 6; i++)
- {
- if (mFaceProxies[i] == proxy)
- mFaceProxyRefs[i]++;
- }
-}
-
-void TextureCubeMap::releaseProxy(const Renderbuffer *proxy)
-{
- for (int i = 0; i < 6; i++)
- {
- if (mFaceProxies[i] == proxy)
- {
- if (mFaceProxyRefs[i] > 0)
- mFaceProxyRefs[i]--;
-
- if (mFaceProxyRefs[i] == 0)
- mFaceProxies[i] = NULL;
- }
- }
-}
-
-GLenum TextureCubeMap::getTarget() const
-{
- return GL_TEXTURE_CUBE_MAP;
-}
-
</del><span class="cx"> GLsizei TextureCubeMap::getWidth(GLenum target, GLint level) const
</span><span class="cx"> {
</span><span class="cx"> if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
</span><del>- return mImageArray[faceIndex(target)][level]->getWidth();
</del><ins>+ return mImageArray[targetToIndex(target)][level]->getWidth();
</ins><span class="cx"> else
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -955,7 +1127,7 @@
</span><span class="cx"> GLsizei TextureCubeMap::getHeight(GLenum target, GLint level) const
</span><span class="cx"> {
</span><span class="cx"> if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
</span><del>- return mImageArray[faceIndex(target)][level]->getHeight();
</del><ins>+ return mImageArray[targetToIndex(target)][level]->getHeight();
</ins><span class="cx"> else
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -963,7 +1135,7 @@
</span><span class="cx"> GLenum TextureCubeMap::getInternalFormat(GLenum target, GLint level) const
</span><span class="cx"> {
</span><span class="cx"> if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
</span><del>- return mImageArray[faceIndex(target)][level]->getInternalFormat();
</del><ins>+ return mImageArray[targetToIndex(target)][level]->getInternalFormat();
</ins><span class="cx"> else
</span><span class="cx"> return GL_NONE;
</span><span class="cx"> }
</span><span class="lines">@@ -971,88 +1143,89 @@
</span><span class="cx"> GLenum TextureCubeMap::getActualFormat(GLenum target, GLint level) const
</span><span class="cx"> {
</span><span class="cx"> if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
</span><del>- return mImageArray[faceIndex(target)][level]->getActualFormat();
</del><ins>+ return mImageArray[targetToIndex(target)][level]->getActualFormat();
</ins><span class="cx"> else
</span><del>- return D3DFMT_UNKNOWN;
</del><ins>+ return GL_NONE;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- setImage(0, level, width, height, format, type, unpackAlignment, pixels);
</del><ins>+ setImage(0, level, width, height, internalFormat, format, type, unpack, pixels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- setImage(1, level, width, height, format, type, unpackAlignment, pixels);
</del><ins>+ setImage(1, level, width, height, internalFormat, format, type, unpack, pixels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- setImage(2, level, width, height, format, type, unpackAlignment, pixels);
</del><ins>+ setImage(2, level, width, height, internalFormat, format, type, unpack, pixels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- setImage(3, level, width, height, format, type, unpackAlignment, pixels);
</del><ins>+ setImage(3, level, width, height, internalFormat, format, type, unpack, pixels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- setImage(4, level, width, height, format, type, unpackAlignment, pixels);
</del><ins>+ setImage(4, level, width, height, internalFormat, format, type, unpack, pixels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- setImage(5, level, width, height, format, type, unpackAlignment, pixels);
</del><ins>+ setImage(5, level, width, height, internalFormat, format, type, unpack, pixels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
</del><ins>+void TextureCubeMap::setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
</ins><span class="cx"> {
</span><span class="cx"> // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
</span><del>- redefineImage(faceIndex(face), level, format, width, height);
</del><ins>+ int faceIndex = targetToIndex(target);
+ redefineImage(faceIndex, level, format, width, height);
</ins><span class="cx">
</span><del>- Texture::setCompressedImage(imageSize, pixels, mImageArray[faceIndex(face)][level]);
</del><ins>+ Texture::setCompressedImage(imageSize, pixels, mImageArray[faceIndex][level]);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::commitRect(int face, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</del><ins>+void TextureCubeMap::commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>- if (level < levelCount())
</del><ins>+ if (isValidFaceLevel(faceIndex, level))
</ins><span class="cx"> {
</span><del>- rx::Image *image = mImageArray[face][level];
- if (image->updateSurface(mTexStorage, face, level, xoffset, yoffset, width, height))
</del><ins>+ rx::Image *image = mImageArray[faceIndex][level];
+ if (image->copyToStorage(mTexStorage, faceIndex, level, xoffset, yoffset, width, height))
</ins><span class="cx"> image->markClean();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- if (Texture::subImage(xoffset, yoffset, width, height, format, type, unpackAlignment, pixels, mImageArray[faceIndex(target)][level]))
</del><ins>+ int faceIndex = targetToIndex(target);
+ if (Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, pixels, mImageArray[faceIndex][level]))
</ins><span class="cx"> {
</span><del>- commitRect(faceIndex(target), level, xoffset, yoffset, width, height);
</del><ins>+ commitRect(faceIndex, level, xoffset, yoffset, width, height);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TextureCubeMap::subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
</span><span class="cx"> {
</span><del>- if (Texture::subImageCompressed(xoffset, yoffset, width, height, format, imageSize, pixels, mImageArray[faceIndex(target)][level]))
</del><ins>+ int faceIndex = targetToIndex(target);
+ if (Texture::subImageCompressed(xoffset, yoffset, 0, width, height, 1, format, imageSize, pixels, mImageArray[faceIndex][level]))
</ins><span class="cx"> {
</span><del>- commitRect(faceIndex(target), level, xoffset, yoffset, width, height);
</del><ins>+ commitRect(faceIndex, level, xoffset, yoffset, width, height);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Tests for cube map sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 86.
</span><del>-bool TextureCubeMap::isSamplerComplete() const
</del><ins>+bool TextureCubeMap::isSamplerComplete(const SamplerState &samplerState) const
</ins><span class="cx"> {
</span><del>- int size = mImageArray[0][0]->getWidth();
</del><ins>+ int size = getBaseLevelWidth();
</ins><span class="cx">
</span><del>- bool mipmapping = isMipmapFiltered();
- bool filtering, renderable;
</del><ins>+ bool mipmapping = IsMipmapFiltered(samplerState);
</ins><span class="cx">
</span><del>- if ((gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0)) == GL_FLOAT && !mRenderer->getFloat32TextureSupport(&filtering, &renderable)) ||
- (gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0) == GL_HALF_FLOAT_OES) && !mRenderer->getFloat16TextureSupport(&filtering, &renderable)))
</del><ins>+ if (!IsTextureFilteringSupported(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0), mRenderer))
</ins><span class="cx"> {
</span><del>- if (mSamplerState.magFilter != GL_NEAREST ||
- (mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
</del><ins>+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1060,7 +1233,7 @@
</span><span class="cx">
</span><span class="cx"> if (!isPow2(size) && !mRenderer->getNonPower2TextureSupport())
</span><span class="cx"> {
</span><del>- if (mSamplerState.wrapS != GL_CLAMP_TO_EDGE || mSamplerState.wrapT != GL_CLAMP_TO_EDGE || mipmapping)
</del><ins>+ if (samplerState.wrapS != GL_CLAMP_TO_EDGE || samplerState.wrapT != GL_CLAMP_TO_EDGE || mipmapping)
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1087,16 +1260,22 @@
</span><span class="cx"> // Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
</span><span class="cx"> bool TextureCubeMap::isCubeComplete() const
</span><span class="cx"> {
</span><del>- if (mImageArray[0][0]->getWidth() <= 0 || mImageArray[0][0]->getHeight() != mImageArray[0][0]->getWidth())
</del><ins>+ int baseWidth = getBaseLevelWidth();
+ int baseHeight = getBaseLevelHeight();
+ GLenum baseFormat = getBaseLevelInternalFormat();
+
+ if (baseWidth <= 0 || baseWidth != baseHeight)
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (unsigned int face = 1; face < 6; face++)
</del><ins>+ for (int faceIndex = 1; faceIndex < 6; faceIndex++)
</ins><span class="cx"> {
</span><del>- if (mImageArray[face][0]->getWidth() != mImageArray[0][0]->getWidth() ||
- mImageArray[face][0]->getWidth() != mImageArray[0][0]->getHeight() ||
- mImageArray[face][0]->getInternalFormat() != mImageArray[0][0]->getInternalFormat())
</del><ins>+ const rx::Image &faceBaseImage = *mImageArray[faceIndex][0];
+
+ if (faceBaseImage.getWidth() != baseWidth ||
+ faceBaseImage.getHeight() != baseHeight ||
+ faceBaseImage.getInternalFormat() != baseFormat )
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1117,57 +1296,119 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GLsizei size = mImageArray[0][0]->getWidth();
</del><ins>+ int levelCount = mipLevels();
</ins><span class="cx">
</span><del>- int q = log2(size);
-
</del><span class="cx"> for (int face = 0; face < 6; face++)
</span><span class="cx"> {
</span><del>- for (int level = 1; level <= q; level++)
</del><ins>+ for (int level = 1; level < levelCount; level++)
</ins><span class="cx"> {
</span><del>- if (mImageArray[face][level]->getInternalFormat() != mImageArray[0][0]->getInternalFormat())
</del><ins>+ if (!isFaceLevelComplete(face, level))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>-
- if (mImageArray[face][level]->getWidth() != std::max(1, size >> level))
- {
- return false;
- }
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool TextureCubeMap::isFaceLevelComplete(int faceIndex, int level) const
+{
+ ASSERT(level >= 0 && faceIndex < 6 && level < (int)ArraySize(mImageArray[faceIndex]) && mImageArray[faceIndex][level] != NULL);
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ int baseSize = getBaseLevelWidth();
+
+ if (baseSize <= 0)
+ {
+ return false;
+ }
+
+ // "isCubeComplete" 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->getInternalFormat() != getBaseLevelInternalFormat())
+ {
+ return false;
+ }
+
+ if (faceLevelImage->getWidth() != std::max(1, baseSize >> level))
+ {
+ return false;
+ }
+
+ return true;
+}
+
</ins><span class="cx"> bool TextureCubeMap::isCompressed(GLenum target, GLint level) const
</span><span class="cx"> {
</span><del>- return IsCompressed(getInternalFormat(target, level));
</del><ins>+ return IsFormatCompressed(getInternalFormat(target, level), mRenderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// Constructs a native texture resource from the texture images, or returns an existing one
-void TextureCubeMap::createTexture()
</del><ins>+bool TextureCubeMap::isDepth(GLenum target, GLint level) const
</ins><span class="cx"> {
</span><del>- GLsizei size = mImageArray[0][0]->getWidth();
</del><ins>+ return GetDepthBits(getInternalFormat(target, level), mRenderer->getCurrentClientVersion()) > 0;
+}
</ins><span class="cx">
</span><del>- if (!(size > 0))
- return; // do not attempt to create native textures for nonexistant data
</del><ins>+void TextureCubeMap::initializeStorage(bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return;
+ }
</ins><span class="cx">
</span><del>- GLint levels = creationLevels(size);
- GLenum internalformat = mImageArray[0][0]->getInternalFormat();
</del><ins>+ // do not attempt to create storage for nonexistant data
+ if (!isFaceLevelComplete(0, 0))
+ {
+ return;
+ }
</ins><span class="cx">
</span><del>- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, mUsage, false, size);
</del><ins>+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
</ins><span class="cx">
</span><del>- if (mTexStorage->isManaged())
</del><ins>+ setCompleteTexStorage(createCompleteStorage(createRenderTarget));
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ updateStorage();
+}
+
+rx::TextureStorageInterfaceCube *TextureCubeMap::createCompleteStorage(bool renderTarget) const
+{
+ GLsizei size = getBaseLevelWidth();
+
+ ASSERT(size > 0);
+
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->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 && mTexStorage->isManaged())
</ins><span class="cx"> {
</span><del>- int levels = levelCount();
-
- for (int face = 0; face < 6; face++)
</del><ins>+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
</ins><span class="cx"> {
</span><del>- for (int level = 0; level < levels; level++)
</del><ins>+ for (int level = 0; level < mTexStorage->getLevelCount(); level++)
</ins><span class="cx"> {
</span><del>- mImageArray[face][level]->setManagedSurface(mTexStorage, face, level);
</del><ins>+ mImageArray[faceIndex][level]->setManagedSurface(mTexStorage, faceIndex, level);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1175,63 +1416,67 @@
</span><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::updateTexture()
</del><ins>+void TextureCubeMap::updateStorage()
</ins><span class="cx"> {
</span><del>- bool mipmapping = isMipmapFiltered() && isMipmapCubeComplete();
-
</del><span class="cx"> for (int face = 0; face < 6; face++)
</span><span class="cx"> {
</span><del>- int levels = (mipmapping ? levelCount() : 1);
-
- for (int level = 0; level < levels; level++)
</del><ins>+ for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
</ins><span class="cx"> {
</span><del>- rx::Image *image = mImageArray[face][level];
-
- if (image->isDirty())
</del><ins>+ if (isFaceLevelComplete(face, level))
</ins><span class="cx"> {
</span><del>- commitRect(face, level, 0, 0, image->getWidth(), image->getHeight());
</del><ins>+ updateStorageFaceLevel(face, level);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::convertToRenderTarget()
</del><ins>+void TextureCubeMap::updateStorageFaceLevel(int faceIndex, int level)
</ins><span class="cx"> {
</span><del>- rx::TextureStorageInterfaceCube *newTexStorage = NULL;
</del><ins>+ ASSERT(level >= 0 && faceIndex < 6 && level < (int)ArraySize(mImageArray[faceIndex]) && mImageArray[faceIndex][level] != NULL);
+ rx::Image *image = mImageArray[faceIndex][level];
</ins><span class="cx">
</span><del>- if (mImageArray[0][0]->getWidth() != 0)
</del><ins>+ if (image->isDirty())
</ins><span class="cx"> {
</span><del>- GLsizei size = mImageArray[0][0]->getWidth();
- GLint levels = mTexStorage != NULL ? mTexStorage->levelCount() : creationLevels(size);
- GLenum internalformat = mImageArray[0][0]->getInternalFormat();
</del><ins>+ commitRect(faceIndex, level, 0, 0, image->getWidth(), image->getHeight());
+ }
+}
</ins><span class="cx">
</span><del>- newTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, GL_FRAMEBUFFER_ATTACHMENT_ANGLE, true, size);
</del><ins>+bool TextureCubeMap::ensureRenderTarget()
+{
+ initializeStorage(true);
</ins><span class="cx">
</span><del>- if (mTexStorage != NULL)
</del><ins>+ if (getBaseLevelWidth() > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
</ins><span class="cx"> {
</span><del>- if (!mRenderer->copyToRenderTarget(newTexStorage, mTexStorage))
</del><ins>+ rx::TextureStorageInterfaceCube *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
</ins><span class="cx"> {
</span><del>- delete newTexStorage;
- return gl::error(GL_OUT_OF_MEMORY);
</del><ins>+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
</ins><span class="cx"> }
</span><ins>+
+ setCompleteTexStorage(newRenderTargetStorage);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- delete mTexStorage;
- mTexStorage = newTexStorage;
-
- mDirtyImages = true;
</del><ins>+ return (mTexStorage && mTexStorage->isRenderTarget());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
</del><ins>+void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
</ins><span class="cx"> {
</span><del>- GLint internalformat = ConvertSizedInternalFormat(format, type);
- redefineImage(faceIndex, level, internalformat, width, height);
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+ : GetSizedInternalFormat(format, type, clientVersion);
</ins><span class="cx">
</span><del>- Texture::setImage(unpackAlignment, pixels, mImageArray[faceIndex][level]);
</del><ins>+ redefineImage(faceIndex, level, sizedInternalFormat, width, height);
+
+ Texture::setImage(unpack, type, pixels, mImageArray[faceIndex][level]);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int TextureCubeMap::faceIndex(GLenum face)
</del><ins>+int TextureCubeMap::targetToIndex(GLenum target)
</ins><span class="cx"> {
</span><span class="cx"> META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1);
</span><span class="cx"> META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2);
</span><span class="lines">@@ -1239,32 +1484,32 @@
</span><span class="cx"> META_ASSERT(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4);
</span><span class="cx"> META_ASSERT(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5);
</span><span class="cx">
</span><del>- return face - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
</del><ins>+ return target - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::redefineImage(int face, GLint level, GLint internalformat, GLsizei width, GLsizei height)
</del><ins>+void TextureCubeMap::redefineImage(int faceIndex, GLint level, GLenum internalformat, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><span class="cx"> // If there currently is a corresponding storage texture image, it has these parameters
</span><del>- const int storageWidth = std::max(1, mImageArray[0][0]->getWidth() >> level);
- const int storageHeight = std::max(1, mImageArray[0][0]->getHeight() >> level);
- const int storageFormat = mImageArray[0][0]->getInternalFormat();
</del><ins>+ const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
</ins><span class="cx">
</span><del>- mImageArray[face][level]->redefine(mRenderer, internalformat, width, height, false);
</del><ins>+ mImageArray[faceIndex][level]->redefine(mRenderer, GL_TEXTURE_CUBE_MAP, internalformat, width, height, 1, false);
</ins><span class="cx">
</span><span class="cx"> if (mTexStorage)
</span><span class="cx"> {
</span><del>- const int storageLevels = mTexStorage->levelCount();
-
</del><ins>+ const int storageLevels = mTexStorage->getLevelCount();
+
</ins><span class="cx"> if ((level >= storageLevels && storageLevels != 0) ||
</span><span class="cx"> width != storageWidth ||
</span><span class="cx"> height != storageHeight ||
</span><span class="cx"> internalformat != storageFormat) // Discard mismatched storage
</span><span class="cx"> {
</span><del>- for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
</del><ins>+ for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
</ins><span class="cx"> {
</span><del>- for (int f = 0; f < 6; f++)
</del><ins>+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
</ins><span class="cx"> {
</span><del>- mImageArray[f][i]->markDirty();
</del><ins>+ mImageArray[faceIndex][level]->markDirty();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1278,27 +1523,25 @@
</span><span class="cx">
</span><span class="cx"> void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
</span><span class="cx"> {
</span><del>- unsigned int faceindex = faceIndex(target);
- GLint internalformat = gl::ConvertSizedInternalFormat(format, GL_UNSIGNED_BYTE);
- redefineImage(faceindex, level, internalformat, width, height);
</del><ins>+ int faceIndex = targetToIndex(target);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
+ : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
+ redefineImage(faceIndex, level, sizedInternalFormat, width, height);
</ins><span class="cx">
</span><del>- if (!mImageArray[faceindex][level]->isRenderableFormat())
</del><ins>+ if (!mImageArray[faceIndex][level]->isRenderableFormat())
</ins><span class="cx"> {
</span><del>- mImageArray[faceindex][level]->copy(0, 0, x, y, width, height, source);
</del><ins>+ mImageArray[faceIndex][level]->copy(0, 0, 0, x, y, width, height, source);
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- if (!mTexStorage || !mTexStorage->isRenderTarget())
- {
- convertToRenderTarget();
- }
-
- mImageArray[faceindex][level]->markClean();
</del><ins>+ ensureRenderTarget();
+ mImageArray[faceIndex][level]->markClean();
</ins><span class="cx">
</span><span class="cx"> ASSERT(width == height);
</span><span class="cx">
</span><del>- if (width > 0 && level < levelCount())
</del><ins>+ if (width > 0 && isValidFaceLevel(faceIndex, level))
</ins><span class="cx"> {
</span><span class="cx"> gl::Rectangle sourceRect;
</span><span class="cx"> sourceRect.x = x;
</span><span class="lines">@@ -1311,40 +1554,44 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
</del><ins>+void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
</ins><span class="cx"> {
</span><del>- GLsizei size = mImageArray[faceIndex(target)][level]->getWidth();
</del><ins>+ int faceIndex = targetToIndex(target);
</ins><span class="cx">
</span><del>- if (xoffset + width > size || yoffset + height > size)
</del><ins>+ GLsizei size = mImageArray[faceIndex][level]->getWidth();
+
+ if (xoffset + width > size || yoffset + height > size || zoffset != 0)
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned int faceindex = faceIndex(target);
</del><ins>+ // 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 "getBaseLevel*" methods reliably otherwise.
+ bool canCreateRenderTarget = isFaceLevelComplete(faceIndex, level) && isCubeComplete();
</ins><span class="cx">
</span><del>- if (!mImageArray[faceindex][level]->isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
</del><ins>+ if (!mImageArray[faceIndex][level]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
</ins><span class="cx"> {
</span><del>- mImageArray[faceindex][level]->copy(0, 0, x, y, width, height, source);
</del><ins>+ mImageArray[faceIndex][level]->copy(0, 0, 0, x, y, width, height, source);
</ins><span class="cx"> mDirtyImages = true;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- if (!mTexStorage || !mTexStorage->isRenderTarget())
</del><ins>+ ensureRenderTarget();
+
+ if (isValidFaceLevel(faceIndex, level))
</ins><span class="cx"> {
</span><del>- convertToRenderTarget();
- }
-
- updateTexture();
</del><ins>+ updateStorageFaceLevel(faceIndex, level);
</ins><span class="cx">
</span><del>- if (level < levelCount())
- {
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
</ins><span class="cx"> gl::Rectangle sourceRect;
</span><span class="cx"> sourceRect.x = x;
</span><span class="cx"> sourceRect.width = width;
</span><span class="cx"> sourceRect.y = y;
</span><span class="cx"> sourceRect.height = height;
</span><span class="cx">
</span><del>- mRenderer->copyImage(source, sourceRect, gl::ExtractFormat(mImageArray[0][0]->getInternalFormat()),
</del><ins>+ mRenderer->copyImage(source, sourceRect, gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
</ins><span class="cx"> xoffset, yoffset, mTexStorage, target, level);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1352,144 +1599,1239 @@
</span><span class="cx">
</span><span class="cx"> void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size)
</span><span class="cx"> {
</span><del>- delete mTexStorage;
- mTexStorage = new rx::TextureStorageInterfaceCube(mRenderer, levels, internalformat, mUsage, false, size);
- mImmutable = true;
-
</del><span class="cx"> for (int level = 0; level < levels; level++)
</span><span class="cx"> {
</span><span class="cx"> GLsizei mipSize = std::max(1, size >> level);
</span><del>- for (int face = 0; face < 6; face++)
</del><ins>+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
</ins><span class="cx"> {
</span><del>- mImageArray[face][level]->redefine(mRenderer, internalformat, mipSize, mipSize, true);
</del><ins>+ mImageArray[faceIndex][level]->redefine(mRenderer, GL_TEXTURE_CUBE_MAP, internalformat, mipSize, mipSize, 1, true);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
</span><span class="cx"> {
</span><del>- for (int face = 0; face < 6; face++)
</del><ins>+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
</ins><span class="cx"> {
</span><del>- mImageArray[face][level]->redefine(mRenderer, GL_NONE, 0, 0, true);
</del><ins>+ mImageArray[faceIndex][level]->redefine(mRenderer, GL_TEXTURE_CUBE_MAP, GL_NONE, 0, 0, 0, true);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mTexStorage->isManaged())
</del><ins>+ 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 < 6; faceIndex++)
</ins><span class="cx"> {
</span><del>- int levels = levelCount();
</del><ins>+ for (int level = 1; level < levelCount; level++)
+ {
+ int faceLevelSize = (std::max(mImageArray[faceIndex][0]->getWidth() >> level, 1));
+ redefineImage(faceIndex, level, mImageArray[faceIndex][0]->getInternalFormat(), faceLevelSize, faceLevelSize);
+ }
+ }
</ins><span class="cx">
</span><del>- for (int face = 0; face < 6; face++)
</del><ins>+ if (mTexStorage && mTexStorage->isRenderTarget())
+ {
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
</ins><span class="cx"> {
</span><del>- for (int level = 0; level < levels; level++)
</del><ins>+ for (int level = 1; level < levelCount; level++)
</ins><span class="cx"> {
</span><del>- mImageArray[face][level]->setManagedSurface(mTexStorage, face, level);
</del><ins>+ mTexStorage->generateMipmap(faceIndex, level);
+
+ mImageArray[faceIndex][level]->markClean();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ else
+ {
+ for (int faceIndex = 0; faceIndex < 6; faceIndex++)
+ {
+ for (int level = 1; level < levelCount; level++)
+ {
+ mRenderer->generateMipmap(mImageArray[faceIndex][level], mImageArray[faceIndex][level - 1]);
+ }
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureCubeMap::generateMipmaps()
</del><ins>+const rx::Image *TextureCubeMap::getBaseLevelImage() const
</ins><span class="cx"> {
</span><del>- if (!isCubeComplete())
</del><ins>+ // 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))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ return gl::error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (!mRenderer->getNonPower2TextureSupport())
</del><ins>+ int faceIndex = targetToIndex(target);
+
+ Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, faceIndex);
+ if (!renderBuffer)
</ins><span class="cx"> {
</span><del>- if (!isPow2(mImageArray[0][0]->getWidth()))
</del><ins>+ 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->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->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->getRenderTarget(target, level);
+}
+
+bool TextureCubeMap::isValidFaceLevel(int faceIndex, int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : 0);
+}
+
+Texture3D::Texture3D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_3D)
+{
+ mTexStorage = NULL;
+
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+ {
+ mImageArray[i] = renderer->createImage();
+ }
+}
+
+Texture3D::~Texture3D()
+{
+ delete mTexStorage;
+ mTexStorage = NULL;
+
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+ {
+ delete mImageArray[i];
+ }
+}
+
+GLsizei Texture3D::getWidth(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getWidth() : 0;
+}
+
+GLsizei Texture3D::getHeight(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getHeight() : 0;
+}
+
+GLsizei Texture3D::getDepth(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getDepth() : 0;
+}
+
+GLenum Texture3D::getInternalFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getInternalFormat() : GL_NONE;
+}
+
+GLenum Texture3D::getActualFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]->getActualFormat() : GL_NONE;
+}
+
+bool Texture3D::isCompressed(GLint level) const
+{
+ return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
+}
+
+bool Texture3D::isDepth(GLint level) const
+{
+ return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
+}
+
+void Texture3D::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+{
+ GLuint clientVersion = mRenderer->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 && fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
- unsigned int q = log2(mImageArray[0][0]->getWidth());
- for (unsigned int f = 0; f < 6; f++)
</del><ins>+ if (!fastUnpacked)
</ins><span class="cx"> {
</span><del>- for (unsigned int i = 1; i <= q; i++)
</del><ins>+ 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 &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 && fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, destRenderTarget))
</ins><span class="cx"> {
</span><del>- redefineImage(f, i, mImageArray[f][0]->getInternalFormat(),
- std::max(mImageArray[f][0]->getWidth() >> i, 1),
- std::max(mImageArray[f][0]->getWidth() >> i, 1));
</del><ins>+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[level]->markClean();
+
+ fastUnpacked = true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (!fastUnpacked && 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 < levels; level++)
+ {
+ GLsizei levelWidth = std::max(1, width >> level);
+ GLsizei levelHeight = std::max(1, height >> level);
+ GLsizei levelDepth = std::max(1, depth >> level);
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_3D, internalformat, levelWidth, levelHeight, levelDepth, true);
+ }
+
+ for (int level = levels; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ mImageArray[level]->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 < levelCount; level++)
+ {
+ redefineImage(level, getBaseLevelInternalFormat(),
+ std::max(getBaseLevelWidth() >> level, 1),
+ std::max(getBaseLevelHeight() >> level, 1),
+ std::max(getBaseLevelDepth() >> level, 1));
+ }
+
</ins><span class="cx"> if (mTexStorage && mTexStorage->isRenderTarget())
</span><span class="cx"> {
</span><del>- for (unsigned int f = 0; f < 6; f++)
</del><ins>+ for (int level = 1; level < levelCount; level++)
</ins><span class="cx"> {
</span><del>- for (unsigned int i = 1; i <= q; i++)
</del><ins>+ mTexStorage->generateMipmap(level);
+
+ mImageArray[level]->markClean();
+ }
+ }
+ else
+ {
+ for (int level = 1; level < levelCount; level++)
+ {
+ mRenderer->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 > mImageArray[level]->getWidth() || yoffset + height > mImageArray[level]->getHeight() || zoffset >= mImageArray[level]->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 & height) and
+ // the current level we're copying to is defined (with appropriate format, width & height)
+ bool canCreateRenderTarget = isLevelComplete(level) && isLevelComplete(0);
+
+ if (!mImageArray[level]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
+ {
+ mImageArray[level]->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->getCurrentClientVersion();
+
+ mRenderer->copyImage(source, sourceRect,
+ gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
+ xoffset, yoffset, zoffset, mTexStorage, level);
+ }
+ }
+}
+
+bool Texture3D::isSamplerComplete(const SamplerState &samplerState) const
+{
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getBaseLevelDepth();
+
+ if (width <= 0 || height <= 0 || depth <= 0)
+ {
+ return false;
+ }
+
+ if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
+ {
+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
+ {
+ return false;
+ }
+ }
+
+ if (IsMipmapFiltered(samplerState) && !isMipmapComplete())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Texture3D::isMipmapComplete() const
+{
+ int levelCount = mipLevels();
+
+ for (int level = 0; level < levelCount; level++)
+ {
+ if (!isLevelComplete(level))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Texture3D::isLevelComplete(int level) const
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getBaseLevelDepth();
+
+ if (width <= 0 || height <= 0 || depth <= 0)
+ {
+ return false;
+ }
+
+ if (level == 0)
+ {
+ return true;
+ }
+
+ rx::Image *levelImage = mImageArray[level];
+
+ if (levelImage->getInternalFormat() != getBaseLevelInternalFormat())
+ {
+ return false;
+ }
+
+ if (levelImage->getWidth() != std::max(1, width >> level))
+ {
+ return false;
+ }
+
+ if (levelImage->getHeight() != std::max(1, height >> level))
+ {
+ return false;
+ }
+
+ if (levelImage->getDepth() != std::max(1, depth >> 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->getRenderTargetSerial(level, layer) : 0);
+}
+
+bool Texture3D::isValidLevel(int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->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 > 0 && height > 0 && depth > 0);
+
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->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->isManaged());
+}
+
+void Texture3D::updateStorage()
+{
+ for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ if (isLevelComplete(level))
+ {
+ updateStorageLevel(level);
+ }
+ }
+}
+
+void Texture3D::updateStorageLevel(int level)
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
+ ASSERT(isLevelComplete(level));
+
+ if (mImageArray[level]->isDirty())
+ {
+ commitRect(level, 0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
+ }
+}
+
+bool Texture3D::ensureRenderTarget()
+{
+ initializeStorage(true);
+
+ if (getBaseLevelWidth() > 0 && getBaseLevelHeight() > 0 && getBaseLevelDepth() > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
+ {
+ rx::TextureStorageInterface3D *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
</ins><span class="cx"> {
</span><del>- mTexStorage->generateMipmap(f, i);
</del><ins>+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- mImageArray[f][i]->markClean();
</del><ins>+ setCompleteTexStorage(newRenderTargetStorage);
+ }
+ }
+
+ return (mTexStorage && mTexStorage->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->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->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->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() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const int storageDepth = std::max(1, getBaseLevelDepth() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ mImageArray[level]->redefine(mRenderer, GL_TEXTURE_3D, internalformat, width, height, depth, false);
+
+ if (mTexStorage)
+ {
+ const int storageLevels = mTexStorage->getLevelCount();
+
+ if ((level >= storageLevels && storageLevels != 0) ||
+ width != storageWidth ||
+ height != storageHeight ||
+ depth != storageDepth ||
+ internalformat != storageFormat) // Discard mismatched storage
+ {
+ for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mImageArray[i]->markDirty();
</ins><span class="cx"> }
</span><ins>+
+ delete mTexStorage;
+ mTexStorage = NULL;
+ mDirtyImages = true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+}
+
+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->copyToStorage(mTexStorage, level, xoffset, yoffset, zoffset, width, height, depth))
+ {
+ image->markClean();
+ }
+ }
+}
+
+Texture2DArray::Texture2DArray(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_2D_ARRAY)
+{
+ mTexStorage = NULL;
+
+ for (int level = 0; level < 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 < IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
+ {
+ for (int layer = 0; layer < mLayerCounts[level]; ++layer)
+ {
+ delete mImageArray[level][layer];
+ }
+ delete[] mImageArray[level];
+ mImageArray[level] = NULL;
+ mLayerCounts[level] = 0;
+ }
+}
+
+GLsizei Texture2DArray::getWidth(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getWidth() : 0;
+}
+
+GLsizei Texture2DArray::getHeight(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getHeight() : 0;
+}
+
+GLsizei Texture2DArray::getLayers(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mLayerCounts[level] : 0;
+}
+
+GLenum Texture2DArray::getInternalFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getInternalFormat() : GL_NONE;
+}
+
+GLenum Texture2DArray::getActualFormat(GLint level) const
+{
+ return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getActualFormat() : GL_NONE;
+}
+
+bool Texture2DArray::isCompressed(GLint level) const
+{
+ return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
+}
+
+bool Texture2DArray::isDepth(GLint level) const
+{
+ return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
+}
+
+void Texture2DArray::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+{
+ GLuint clientVersion = mRenderer->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 < depth; i++)
+ {
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(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->getCurrentClientVersion();
+ GLsizei inputDepthPitch = gl::GetDepthPitch(format, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
+
+ for (int i = 0; i < depth; i++)
+ {
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(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 &unpack, const void *pixels)
+{
+ GLenum internalformat = getInternalFormat(level);
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputDepthPitch = gl::GetDepthPitch(internalformat, type, clientVersion, width, height, unpack.alignment);
+
+ for (int i = 0; i < depth; i++)
+ {
+ int layer = zoffset + i;
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(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->getCurrentClientVersion();
+ GLsizei inputDepthPitch = gl::GetDepthPitch(format, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
+
+ for (int i = 0; i < depth; i++)
+ {
+ int layer = zoffset + i;
+ const void *layerPixels = pixels ? (reinterpret_cast<const unsigned char*>(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 < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ GLsizei levelWidth = std::max(1, width >> level);
+ GLsizei levelHeight = std::max(1, height >> level);
+
+ mLayerCounts[level] = (level < levels ? depth : 0);
+
+ if (mLayerCounts[level] > 0)
+ {
+ // Create new images for this level
+ mImageArray[level] = new rx::Image*[mLayerCounts[level]];
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer] = mRenderer->createImage();
+ mImageArray[level][layer]->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 < levelCount; level++)
+ {
+ redefineImage(level, baseFormat, std::max(baseWidth >> level, 1), std::max(baseHeight >> level, 1), baseDepth);
+ }
+
+ if (mTexStorage && mTexStorage->isRenderTarget())
+ {
+ for (int level = 1; level < levelCount; level++)
+ {
+ mTexStorage->generateMipmap(level);
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer]->markClean();
+ }
+ }
+ }
</ins><span class="cx"> else
</span><span class="cx"> {
</span><del>- for (unsigned int f = 0; f < 6; f++)
</del><ins>+ for (int level = 1; level < levelCount; level++)
</ins><span class="cx"> {
</span><del>- for (unsigned int i = 1; i <= q; i++)
</del><ins>+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
</ins><span class="cx"> {
</span><del>- mRenderer->generateMipmap(mImageArray[f][i], mImageArray[f][i - 1]);
</del><ins>+ mRenderer->generateMipmap(mImageArray[level][layer], mImageArray[level - 1][layer]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Renderbuffer *TextureCubeMap::getRenderbuffer(GLenum target)
</del><ins>+const rx::Image *Texture2DArray::getBaseLevelImage() const
</ins><span class="cx"> {
</span><del>- if (!IsCubemapTextureTarget(target))
</del><ins>+ return (mLayerCounts[0] > 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 > getWidth(level) || yoffset + height > getHeight(level) || zoffset >= getLayers(level) || getLayers(level) == 0)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
</del><ins>+ return gl::error(GL_INVALID_VALUE);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned int face = faceIndex(target);
</del><ins>+ // can only make our texture storage to a render target if level 0 is defined (with a width & height) and
+ // the current level we're copying to is defined (with appropriate format, width & height)
+ bool canCreateRenderTarget = isLevelComplete(level) && isLevelComplete(0);
</ins><span class="cx">
</span><del>- if (mFaceProxies[face] == NULL)
</del><ins>+ if (!mImageArray[level][0]->isRenderableFormat() || (!mTexStorage && !canCreateRenderTarget))
</ins><span class="cx"> {
</span><del>- mFaceProxies[face] = new Renderbuffer(mRenderer, id(), new RenderbufferTextureCubeMap(this, target));
</del><ins>+ mImageArray[level][zoffset]->copy(xoffset, yoffset, 0, x, y, width, height, source);
+ mDirtyImages = true;
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ ensureRenderTarget();
</ins><span class="cx">
</span><del>- return mFaceProxies[face];
</del><ins>+ if (isValidLevel(level))
+ {
+ updateStorageLevel(level);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ gl::Rectangle sourceRect;
+ sourceRect.x = x;
+ sourceRect.width = width;
+ sourceRect.y = y;
+ sourceRect.height = height;
+
+ mRenderer->copyImage(source, sourceRect, gl::GetFormat(getInternalFormat(0), clientVersion),
+ xoffset, yoffset, zoffset, mTexStorage, level);
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-rx::RenderTarget *TextureCubeMap::getRenderTarget(GLenum target)
</del><ins>+bool Texture2DArray::isSamplerComplete(const SamplerState &samplerState) const
</ins><span class="cx"> {
</span><del>- ASSERT(IsCubemapTextureTarget(target));
</del><ins>+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei depth = getLayers(0);
</ins><span class="cx">
</span><ins>+ if (width <= 0 || height <= 0 || depth <= 0)
+ {
+ return false;
+ }
+
+ if (!IsTextureFilteringSupported(getBaseLevelInternalFormat(), mRenderer))
+ {
+ if (samplerState.magFilter != GL_NEAREST ||
+ (samplerState.minFilter != GL_NEAREST && samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
+ {
+ return false;
+ }
+ }
+
+ if (IsMipmapFiltered(samplerState) && !isMipmapComplete())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Texture2DArray::isMipmapComplete() const
+{
+ int levelCount = mipLevels();
+
+ for (int level = 1; level < levelCount; level++)
+ {
+ if (!isLevelComplete(level))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Texture2DArray::isLevelComplete(int level) const
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mImageArray));
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ GLsizei width = getBaseLevelWidth();
+ GLsizei height = getBaseLevelHeight();
+ GLsizei layers = getLayers(0);
+
+ if (width <= 0 || height <= 0 || layers <= 0)
+ {
+ return false;
+ }
+
+ if (level == 0)
+ {
+ return true;
+ }
+
+ if (getInternalFormat(level) != getInternalFormat(0))
+ {
+ return false;
+ }
+
+ if (getWidth(level) != std::max(1, width >> level))
+ {
+ return false;
+ }
+
+ if (getHeight(level) != std::max(1, height >> 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->getRenderTargetSerial(level, layer) : 0);
+}
+
+bool Texture2DArray::isValidLevel(int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->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 > 0 && height > 0 && depth > 0);
+
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->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->isManaged());
+}
+
+void Texture2DArray::updateStorage()
+{
+ for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ if (isLevelComplete(level))
+ {
+ updateStorageLevel(level);
+ }
+ }
+}
+
+void Texture2DArray::updateStorageLevel(int level)
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mLayerCounts));
+ ASSERT(isLevelComplete(level));
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ ASSERT(mImageArray[level] != NULL && mImageArray[level][layer] != NULL);
+ if (mImageArray[level][layer]->isDirty())
+ {
+ commitRect(level, 0, 0, layer, getWidth(level), getHeight(level));
+ }
+ }
+}
+
+bool Texture2DArray::ensureRenderTarget()
+{
+ initializeStorage(true);
+
+ if (getBaseLevelWidth() > 0 && getBaseLevelHeight() > 0 && getLayers(0) > 0)
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
+ {
+ rx::TextureStorageInterface2DArray *newRenderTargetStorage = createCompleteStorage(true);
+
+ if (!mRenderer->copyToRenderTarget(newRenderTargetStorage, mTexStorage))
+ {
+ delete newRenderTargetStorage;
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+
+ setCompleteTexStorage(newRenderTargetStorage);
+ }
+ }
+
+ return (mTexStorage && mTexStorage->isRenderTarget());
+}
+
+rx::RenderTarget *Texture2DArray::getRenderTarget(GLint level, GLint layer)
+{
</ins><span class="cx"> // ensure the underlying texture is created
</span><del>- if (getStorage(true) == NULL)
</del><ins>+ if (!ensureRenderTarget())
</ins><span class="cx"> {
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateTexture();
-
- return mTexStorage->getRenderTarget(target);
</del><ins>+ updateStorageLevel(level);
+
+ // ensure this is NOT a depth texture
+ if (isDepth(level))
+ {
+ return NULL;
+ }
+
+ return mTexStorage->getRenderTarget(level, layer);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-int TextureCubeMap::levelCount()
</del><ins>+rx::RenderTarget *Texture2DArray::getDepthStencil(GLint level, GLint layer)
</ins><span class="cx"> {
</span><del>- return mTexStorage ? mTexStorage->levelCount() - getLodOffset() : 0;
</del><ins>+ // 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->getRenderTarget(level, layer);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-rx::TextureStorageInterface *TextureCubeMap::getStorage(bool renderTarget)
</del><ins>+void Texture2DArray::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
</ins><span class="cx"> {
</span><del>- if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
</del><ins>+ // If there currently is a corresponding storage texture image, it has these parameters
+ const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
+ const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
+ const int storageDepth = getLayers(0);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
</ins><span class="cx"> {
</span><del>- if (renderTarget)
</del><ins>+ delete mImageArray[level][layer];
+ }
+ delete[] mImageArray[level];
+ mImageArray[level] = NULL;
+ mLayerCounts[level] = depth;
+
+ if (depth > 0)
+ {
+ mImageArray[level] = new rx::Image*[depth]();
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
</ins><span class="cx"> {
</span><del>- convertToRenderTarget();
</del><ins>+ mImageArray[level][layer] = mRenderer->createImage();
+ mImageArray[level][layer]->redefine(mRenderer, GL_TEXTURE_2D_ARRAY, internalformat, width, height, 1, false);
</ins><span class="cx"> }
</span><del>- else
</del><ins>+ }
+
+ if (mTexStorage)
+ {
+ const int storageLevels = mTexStorage->getLevelCount();
+
+ if ((level >= storageLevels && storageLevels != 0) ||
+ width != storageWidth ||
+ height != storageHeight ||
+ depth != storageDepth ||
+ internalformat != storageFormat) // Discard mismatched storage
</ins><span class="cx"> {
</span><del>- createTexture();
</del><ins>+ for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer]->markDirty();
+ }
+ }
+
+ delete mTexStorage;
+ mTexStorage = NULL;
+ mDirtyImages = true;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- return mTexStorage;
</del><ins>+void Texture2DArray::commitRect(GLint level, GLint xoffset, GLint yoffset, GLint layerTarget, GLsizei width, GLsizei height)
+{
+ if (isValidLevel(level) && layerTarget < getLayers(level))
+ {
+ rx::Image *image = mImageArray[level][layerTarget];
+ if (image->copyToStorage(mTexStorage, level, xoffset, yoffset, layerTarget, width, height))
+ {
+ image->markClean();
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Textureh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -14,11 +14,13 @@
</span><span class="cx"> #include <vector>
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><span class="cx"> #include "common/RefCountObject.h"
</span><span class="cx"> #include "libGLESv2/angletypes.h"
</span><ins>+#include "libGLESv2/RenderbufferProxySet.h"
</ins><span class="cx">
</span><span class="cx"> namespace egl
</span><span class="cx"> {
</span><span class="lines">@@ -31,6 +33,8 @@
</span><span class="cx"> class TextureStorageInterface;
</span><span class="cx"> class TextureStorageInterface2D;
</span><span class="cx"> class TextureStorageInterfaceCube;
</span><ins>+class TextureStorageInterface3D;
+class TextureStorageInterface2DArray;
</ins><span class="cx"> class RenderTarget;
</span><span class="cx"> class Image;
</span><span class="cx"> }
</span><span class="lines">@@ -45,75 +49,104 @@
</span><span class="cx"> // These are the maximums the implementation can support
</span><span class="cx"> // The actual GL caps are limited by the device caps
</span><span class="cx"> // and should be queried from the Context
</span><del>- IMPLEMENTATION_MAX_TEXTURE_SIZE = 16384,
</del><ins>+ IMPLEMENTATION_MAX_2D_TEXTURE_SIZE = 16384,
</ins><span class="cx"> IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
</span><ins>+ IMPLEMENTATION_MAX_3D_TEXTURE_SIZE = 2048,
+ IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
</ins><span class="cx">
</span><span class="cx"> IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15 // 1+log2 of MAX_TEXTURE_SIZE
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+bool IsMipmapFiltered(const SamplerState &samplerState);
+
</ins><span class="cx"> class Texture : public RefCountObject
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- Texture(rx::Renderer *renderer, GLuint id);
</del><ins>+ Texture(rx::Renderer *renderer, GLuint id, GLenum target);
</ins><span class="cx">
</span><span class="cx"> virtual ~Texture();
</span><span class="cx">
</span><del>- virtual void addProxyRef(const Renderbuffer *proxy) = 0;
- virtual void releaseProxy(const Renderbuffer *proxy) = 0;
</del><ins>+ void addProxyRef(const Renderbuffer *proxy);
+ void releaseProxy(const Renderbuffer *proxy);
</ins><span class="cx">
</span><del>- virtual GLenum getTarget() const = 0;
</del><ins>+ GLenum getTarget() const;
</ins><span class="cx">
</span><del>- bool setMinFilter(GLenum filter);
- bool setMagFilter(GLenum filter);
- bool setWrapS(GLenum wrap);
- bool setWrapT(GLenum wrap);
- bool setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy);
- bool setUsage(GLenum usage);
</del><ins>+ 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);
</ins><span class="cx">
</span><span class="cx"> GLenum getMinFilter() const;
</span><span class="cx"> GLenum getMagFilter() const;
</span><span class="cx"> GLenum getWrapS() const;
</span><span class="cx"> GLenum getWrapT() const;
</span><ins>+ GLenum getWrapR() const;
</ins><span class="cx"> float getMaxAnisotropy() const;
</span><del>- int getLodOffset();
</del><ins>+ 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;
</ins><span class="cx"> void getSamplerState(SamplerState *sampler);
</span><span class="cx"> GLenum getUsage() const;
</span><del>- bool isMipmapFiltered() const;
</del><span class="cx">
</span><del>- virtual bool isSamplerComplete() const = 0;
</del><ins>+ GLint getBaseLevelWidth() const;
+ GLint getBaseLevelHeight() const;
+ GLint getBaseLevelDepth() const;
+ GLenum getBaseLevelInternalFormat() const;
</ins><span class="cx">
</span><ins>+ virtual bool isSamplerComplete(const SamplerState &samplerState) const = 0;
+
</ins><span class="cx"> rx::TextureStorageInterface *getNativeTexture();
</span><del>- virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
</del><span class="cx">
</span><span class="cx"> virtual void generateMipmaps() = 0;
</span><del>- virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
</del><ins>+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
</ins><span class="cx">
</span><span class="cx"> bool hasDirtyParameters() const;
</span><span class="cx"> bool hasDirtyImages() const;
</span><span class="cx"> void resetDirty();
</span><span class="cx"> unsigned int getTextureSerial();
</span><del>- unsigned int getRenderTargetSerial(GLenum target);
</del><span class="cx">
</span><span class="cx"> bool isImmutable() const;
</span><ins>+ int immutableLevelCount();
</ins><span class="cx">
</span><span class="cx"> static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
</span><span class="cx">
</span><span class="cx"> protected:
</span><del>- void setImage(GLint unpackAlignment, const void *pixels, rx::Image *image);
- bool subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, rx::Image *image);
</del><ins>+ void setImage(const PixelUnpackState &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 &unpack, const void *pixels, rx::Image *image);
</ins><span class="cx"> void setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image);
</span><del>- bool subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image);
</del><ins>+ 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 &unpack, GLenum sizedInternalFormat);
+ bool fastUnpackPixels(const PixelUnpackState &unpack, const void *pixels, const Box &destArea,
+ GLenum sizedInternalFormat, GLenum type, rx::RenderTarget *destRenderTarget);
</ins><span class="cx">
</span><del>- GLint creationLevels(GLsizei width, GLsizei height) const;
- GLint creationLevels(GLsizei size) const;
</del><ins>+ GLint creationLevels(GLsizei width, GLsizei height, GLsizei depth) const;
+ int mipLevels() const;
</ins><span class="cx">
</span><del>- virtual void createTexture() = 0;
- virtual void updateTexture() = 0;
- virtual void convertToRenderTarget() = 0;
- virtual rx::RenderTarget *getRenderTarget(GLenum target) = 0;
</del><ins>+ virtual void initializeStorage(bool renderTarget) = 0;
+ virtual void updateStorage() = 0;
+ virtual bool ensureRenderTarget() = 0;
</ins><span class="cx">
</span><del>- virtual int levelCount() = 0;
-
</del><span class="cx"> rx::Renderer *mRenderer;
</span><span class="cx">
</span><span class="cx"> SamplerState mSamplerState;
</span><span class="lines">@@ -123,10 +156,20 @@
</span><span class="cx">
</span><span class="cx"> bool mImmutable;
</span><span class="cx">
</span><ins>+ 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;
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Texture);
</span><span class="cx">
</span><del>- virtual rx::TextureStorageInterface *getStorage(bool renderTarget) = 0;
</del><ins>+ virtual rx::TextureStorageInterface *getBaseLevelStorage() = 0;
+ virtual const rx::Image *getBaseLevelImage() const = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class Texture2D : public Texture
</span><span class="lines">@@ -136,11 +179,6 @@
</span><span class="cx">
</span><span class="cx"> ~Texture2D();
</span><span class="cx">
</span><del>- void addProxyRef(const Renderbuffer *proxy);
- void releaseProxy(const Renderbuffer *proxy);
-
- virtual GLenum getTarget() const;
-
</del><span class="cx"> GLsizei getWidth(GLint level) const;
</span><span class="cx"> GLsizei getHeight(GLint level) const;
</span><span class="cx"> GLenum getInternalFormat(GLint level) const;
</span><span class="lines">@@ -148,53 +186,52 @@
</span><span class="cx"> bool isCompressed(GLint level) const;
</span><span class="cx"> bool isDepth(GLint level) const;
</span><span class="cx">
</span><del>- void setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
</del><ins>+ void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
</ins><span class="cx"> void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
</span><del>- void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
</del><ins>+ void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
</ins><span class="cx"> void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
</span><span class="cx"> void copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
</span><del>- virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
</del><ins>+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
</ins><span class="cx"> void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
</span><span class="cx">
</span><del>- virtual bool isSamplerComplete() const;
</del><ins>+ virtual bool isSamplerComplete(const SamplerState &samplerState) const;
</ins><span class="cx"> virtual void bindTexImage(egl::Surface *surface);
</span><span class="cx"> virtual void releaseTexImage();
</span><span class="cx">
</span><span class="cx"> virtual void generateMipmaps();
</span><span class="cx">
</span><del>- virtual Renderbuffer *getRenderbuffer(GLenum target);
</del><ins>+ Renderbuffer *getRenderbuffer(GLint level);
+ unsigned int getRenderTargetSerial(GLint level);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> friend class RenderbufferTexture2D;
</span><del>- virtual rx::RenderTarget *getRenderTarget(GLenum target);
- virtual rx::RenderTarget *getDepthStencil(GLenum target);
- virtual int levelCount();
</del><ins>+ rx::RenderTarget *getRenderTarget(GLint level);
+ rx::RenderTarget *getDepthSencil(GLint level);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Texture2D);
</span><span class="cx">
</span><del>- virtual void createTexture();
- virtual void updateTexture();
- virtual void convertToRenderTarget();
- virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
</del><ins>+ virtual void initializeStorage(bool renderTarget);
+ rx::TextureStorageInterface2D *createCompleteStorage(bool renderTarget) const;
+ void setCompleteTexStorage(rx::TextureStorageInterface2D *newCompleteTexStorage);
</ins><span class="cx">
</span><ins>+ virtual void updateStorage();
+ virtual bool ensureRenderTarget();
+ virtual rx::TextureStorageInterface *getBaseLevelStorage();
+ virtual const rx::Image *getBaseLevelImage() const;
+
</ins><span class="cx"> bool isMipmapComplete() const;
</span><ins>+ bool isValidLevel(int level) const;
+ bool isLevelComplete(int level) const;
+ void updateStorageLevel(int level);
</ins><span class="cx">
</span><del>- void redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height);
</del><ins>+ void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height);
</ins><span class="cx"> void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
</span><span class="cx">
</span><span class="cx"> rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
</span><span class="cx">
</span><span class="cx"> rx::TextureStorageInterface2D *mTexStorage;
</span><span class="cx"> egl::Surface *mSurface;
</span><del>-
- // A specific internal reference count is kept for colorbuffer proxy references,
- // because, as the renderbuffer acting as proxy will maintain a binding pointer
- // back to this texture, there would be a circular reference if we used a binding
- // pointer here. This reference count will cause the pointer to be set to NULL if
- // the count drops to zero, but will not cause deletion of the Renderbuffer.
- Renderbuffer *mColorbufferProxy;
- unsigned int mProxyRefs;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class TextureCubeMap : public Texture
</span><span class="lines">@@ -204,72 +241,196 @@
</span><span class="cx">
</span><span class="cx"> ~TextureCubeMap();
</span><span class="cx">
</span><del>- void addProxyRef(const Renderbuffer *proxy);
- void releaseProxy(const Renderbuffer *proxy);
-
- virtual GLenum getTarget() const;
-
</del><span class="cx"> GLsizei getWidth(GLenum target, GLint level) const;
</span><span class="cx"> GLsizei getHeight(GLenum target, GLint level) const;
</span><span class="cx"> GLenum getInternalFormat(GLenum target, GLint level) const;
</span><span class="cx"> GLenum getActualFormat(GLenum target, GLint level) const;
</span><span class="cx"> bool isCompressed(GLenum target, GLint level) const;
</span><ins>+ bool isDepth(GLenum target, GLint level) const;
</ins><span class="cx">
</span><del>- void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
- void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
</del><ins>+ void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+ void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
</ins><span class="cx">
</span><del>- void setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
</del><ins>+ void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
</ins><span class="cx">
</span><del>- void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
</del><ins>+ void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
</ins><span class="cx"> void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
</span><span class="cx"> void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
</span><del>- virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
</del><ins>+ virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
</ins><span class="cx"> void storage(GLsizei levels, GLenum internalformat, GLsizei size);
</span><span class="cx">
</span><del>- virtual bool isSamplerComplete() const;
</del><ins>+ virtual bool isSamplerComplete(const SamplerState &samplerState) const;
+ bool isCubeComplete() const;
</ins><span class="cx">
</span><span class="cx"> virtual void generateMipmaps();
</span><span class="cx">
</span><del>- virtual Renderbuffer *getRenderbuffer(GLenum target);
</del><ins>+ Renderbuffer *getRenderbuffer(GLenum target, GLint level);
+ unsigned int getRenderTargetSerial(GLenum target, GLint level);
</ins><span class="cx">
</span><del>- static unsigned int faceIndex(GLenum face);
</del><ins>+ static int targetToIndex(GLenum target);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> friend class RenderbufferTextureCubeMap;
</span><del>- virtual rx::RenderTarget *getRenderTarget(GLenum target);
- virtual int levelCount();
</del><ins>+ rx::RenderTarget *getRenderTarget(GLenum target, GLint level);
+ rx::RenderTarget *getDepthStencil(GLenum target, GLint level);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
</span><span class="cx">
</span><del>- virtual void createTexture();
- virtual void updateTexture();
- virtual void convertToRenderTarget();
- virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
</del><ins>+ virtual void initializeStorage(bool renderTarget);
+ rx::TextureStorageInterfaceCube *createCompleteStorage(bool renderTarget) const;
+ void setCompleteTexStorage(rx::TextureStorageInterfaceCube *newCompleteTexStorage);
</ins><span class="cx">
</span><del>- bool isCubeComplete() const;
</del><ins>+ virtual void updateStorage();
+ virtual bool ensureRenderTarget();
+ virtual rx::TextureStorageInterface *getBaseLevelStorage();
+ virtual const rx::Image *getBaseLevelImage() const;
+
</ins><span class="cx"> bool isMipmapCubeComplete() const;
</span><ins>+ bool isValidFaceLevel(int faceIndex, int level) const;
+ bool isFaceLevelComplete(int faceIndex, int level) const;
+ void updateStorageFaceLevel(int faceIndex, int level);
</ins><span class="cx">
</span><del>- void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
</del><ins>+ void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
</ins><span class="cx"> void commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
</span><del>- void redefineImage(int faceIndex, GLint level, GLint internalformat, GLsizei width, GLsizei height);
</del><ins>+ void redefineImage(int faceIndex, GLint level, GLenum internalformat, GLsizei width, GLsizei height);
</ins><span class="cx">
</span><span class="cx"> rx::Image *mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
</span><span class="cx">
</span><span class="cx"> rx::TextureStorageInterfaceCube *mTexStorage;
</span><ins>+};
</ins><span class="cx">
</span><del>- // A specific internal reference count is kept for colorbuffer proxy references,
- // because, as the renderbuffer acting as proxy will maintain a binding pointer
- // back to this texture, there would be a circular reference if we used a binding
- // pointer here. This reference count will cause the pointer to be set to NULL if
- // the count drops to zero, but will not cause deletion of the Renderbuffer.
- Renderbuffer *mFaceProxies[6];
- unsigned int *mFaceProxyRefs[6];
</del><ins>+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 &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 &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 &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;
</ins><span class="cx"> };
</span><ins>+
+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 &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 &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 &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;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // LIBGLESV2_TEXTURE_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2TransformFeedbackcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</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.
+//
+
+#include "libGLESv2/TransformFeedback.h"
+
+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;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2TransformFeedbackh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.h        2014-04-30 22:57:08 UTC (rev 168055)
</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 LIBGLESV2_TRANSFORM_FEEDBACK_H_
+#define LIBGLESV2_TRANSFORM_FEEDBACK_H_
+
+#include "common/angleutils.h"
+#include "common/RefCountObject.h"
+
+#define GL_APICALL
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+
+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_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Uniformcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,37 +7,100 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/Uniform.h"
</span><span class="cx">
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
</ins><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx">
</span><del>-Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize)
- : type(type), precision(precision), name(name), arraySize(arraySize)
</del><ins>+LinkedUniform::LinkedUniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize,
+ const int blockIndex, const BlockMemberInfo &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)
</ins><span class="cx"> {
</span><del>- int bytes = gl::UniformInternalSize(type) * elementCount();
- data = new unsigned char[bytes];
- memset(data, 0, bytes);
- dirty = true;
-
- psRegisterIndex = -1;
- vsRegisterIndex = -1;
- registerCount = VariableRowCount(type) * elementCount();
</del><ins>+ // 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();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Uniform::~Uniform()
</del><ins>+LinkedUniform::~LinkedUniform()
</ins><span class="cx"> {
</span><span class="cx"> delete[] data;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Uniform::isArray() const
</del><ins>+bool LinkedUniform::isArray() const
</ins><span class="cx"> {
</span><span class="cx"> return arraySize > 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int Uniform::elementCount() const
</del><ins>+unsigned int LinkedUniform::elementCount() const
</ins><span class="cx"> {
</span><span class="cx"> return arraySize > 0 ? arraySize : 1;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool LinkedUniform::isReferencedByVertexShader() const
+{
+ return vsRegisterIndex != GL_INVALID_INDEX;
</ins><span class="cx"> }
</span><ins>+
+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 &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="trunkSourceThirdPartyANGLEsrclibGLESv2Uniformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,38 +11,70 @@
</span><span class="cx"> #include <vector>
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><ins>+#include "angletypes.h"
+#include "common/shadervars.h"
</ins><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx">
</span><span class="cx"> // Helper struct representing a single shader uniform
</span><del>-struct Uniform
</del><ins>+struct LinkedUniform
</ins><span class="cx"> {
</span><del>- Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize);
</del><ins>+ LinkedUniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize, const int blockIndex, const BlockMemberInfo &blockInfo);
</ins><span class="cx">
</span><del>- ~Uniform();
</del><ins>+ ~LinkedUniform();
</ins><span class="cx">
</span><span class="cx"> bool isArray() const;
</span><span class="cx"> unsigned int elementCount() const;
</span><ins>+ bool isReferencedByVertexShader() const;
+ bool isReferencedByFragmentShader() const;
+ bool isInDefaultBlock() const;
+ size_t dataSize() const;
+ bool isSampler() const;
</ins><span class="cx">
</span><span class="cx"> const GLenum type;
</span><span class="cx"> const GLenum precision;
</span><span class="cx"> const std::string name;
</span><span class="cx"> const unsigned int arraySize;
</span><ins>+ const int blockIndex;
+ const BlockMemberInfo blockInfo;
</ins><span class="cx">
</span><span class="cx"> unsigned char *data;
</span><span class="cx"> bool dirty;
</span><span class="cx">
</span><del>- int psRegisterIndex;
- int vsRegisterIndex;
</del><ins>+ unsigned int psRegisterIndex;
+ unsigned int vsRegisterIndex;
</ins><span class="cx"> unsigned int registerCount;
</span><ins>+
+ // Register "elements" 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;
</ins><span class="cx"> };
</span><span class="cx">
</span><del>-typedef std::vector<Uniform*> UniformArray;
</del><ins>+// Helper struct representing a single shader uniform block
+struct UniformBlock
+{
+ // use GL_INVALID_INDEX for non-array elements
+ UniformBlock(const std::string &name, unsigned int elementIndex, unsigned int dataSize);
</ins><span class="cx">
</span><ins>+ bool isArrayElement() const;
+ bool isReferencedByVertexShader() const;
+ bool isReferencedByFragmentShader() const;
+
+ const std::string name;
+ const unsigned int elementIndex;
+ const unsigned int dataSize;
+
+ std::vector<unsigned int> memberUniformIndexes;
+
+ unsigned int psRegisterIndex;
+ unsigned int vsRegisterIndex;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // LIBGLESV2_UNIFORM_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2VertexArraycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+#include "precompiled.h"
+//
+// 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 "libGLESv2/VertexArray.h"
+#include "libGLESv2/Buffer.h"
+
+namespace gl
+{
+
+VertexArray::VertexArray(rx::Renderer *renderer, GLuint id)
+ : RefCountObject(id)
+{
+}
+
+VertexArray::~VertexArray()
+{
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ mVertexAttributes[i].mBoundBuffer.set(NULL);
+ }
+ mElementArrayBuffer.set(NULL);
+}
+
+void VertexArray::detachBuffer(GLuint bufferName)
+{
+ for (int attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
+ {
+ if (mVertexAttributes[attribute].mBoundBuffer.id() == bufferName)
+ {
+ mVertexAttributes[attribute].mBoundBuffer.set(NULL);
+ }
+ }
+
+ if (mElementArrayBuffer.id() == bufferName)
+ {
+ mElementArrayBuffer.set(NULL);
+ }
+}
+
+const VertexAttribute& VertexArray::getVertexAttribute(unsigned int attributeIndex) const
+{
+ ASSERT(attributeIndex < MAX_VERTEX_ATTRIBS);
+ return mVertexAttributes[attributeIndex];
+}
+
+void VertexArray::setVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
+ mVertexAttributes[index].mDivisor = divisor;
+}
+
+void VertexArray::enableAttribute(unsigned int attributeIndex, bool enabledState)
+{
+ ASSERT(attributeIndex < 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 < gl::MAX_VERTEX_ATTRIBS);
+ mVertexAttributes[attributeIndex].setState(boundBuffer, size, type, normalized, pureInteger, stride, pointer);
+}
+
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2VertexArrayh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,54 @@
</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 LIBGLESV2_VERTEXARRAY_H_
+#define LIBGLESV2_VERTEXARRAY_H_
+
+#include "common/RefCountObject.h"
+#include "libGLESv2/constants.h"
+#include "libGLESv2/VertexAttribute.h"
+
+namespace rx
+{
+class Renderer;
+}
+
+namespace gl
+{
+class Buffer;
+
+class VertexArray : public RefCountObject
+{
+ public:
+ VertexArray(rx::Renderer *renderer, GLuint id);
+ ~VertexArray();
+
+ const VertexAttribute& 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<Buffer> mElementArrayBuffer;
+};
+
+}
+
+#endif // LIBGLESV2_VERTEXARRAY_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2VertexAttributeh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexAttribute.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexAttribute.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexAttribute.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,156 @@
</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 LIBGLESV2_VERTEXATTRIBUTE_H_
+#define LIBGLESV2_VERTEXATTRIBUTE_H_
+
+#include "libGLESv2/Buffer.h"
+
+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 <typename T>
+ T querySingleParameter(GLenum pname) const
+ {
+ switch (pname)
+ {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ return static_cast<T>(mArrayEnabled ? GL_TRUE : GL_FALSE);
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ return static_cast<T>(mSize);
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ return static_cast<T>(mStride);
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ return static_cast<T>(mType);
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ return static_cast<T>(mNormalized ? GL_TRUE : GL_FALSE);
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ return static_cast<T>(mBoundBuffer.id());
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+ return static_cast<T>(mDivisor);
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ return static_cast<T>(mPureInteger ? GL_TRUE : GL_FALSE);
+ default:
+ UNREACHABLE();
+ return static_cast<T>(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<Buffer> 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 < 4; valueIndex++)
+ {
+ FloatValues[valueIndex] = floatValues[valueIndex];
+ }
+ Type = GL_FLOAT;
+ }
+
+ void setIntValues(const GLint intValues[4])
+ {
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ IntValues[valueIndex] = intValues[valueIndex];
+ }
+ Type = GL_INT;
+ }
+
+ void setUnsignedIntValues(const GLuint unsignedIntValues[4])
+ {
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
+ }
+ Type = GL_UNSIGNED_INT;
+ }
+
+ bool operator==(const VertexAttribCurrentValueData &other)
+ {
+ return (Type == other.Type && memcmp(FloatValues, other.FloatValues, sizeof(float) * 4) == 0);
+ }
+
+ bool operator!=(const VertexAttribCurrentValueData &other)
+ {
+ return !(*this == other);
+ }
+};
+
+}
+
+#endif // LIBGLESV2_VERTEXATTRIBUTE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2angletypescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,177 @@
</span><ins>+#include "precompiled.h"
+//
+// 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 "libGLESv2/angletypes.h"
+#include "libGLESv2/ProgramBinary.h"
+#include "libGLESv2/VertexAttribute.h"
+
+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 < b)
+ {
+ *minimum = a;
+ *maximum = b;
+ }
+ else
+ {
+ *minimum = b;
+ *maximum = a;
+ }
+}
+
+bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *intersection)
+{
+ int minSourceX, maxSourceX, minSourceY, maxSourceY;
+ MinMax(source.x, source.x + source.width, &minSourceX, &maxSourceX);
+ MinMax(source.y, source.y + source.height, &minSourceY, &maxSourceY);
+
+ int minClipX, maxClipX, minClipY, maxClipY;
+ MinMax(clip.x, clip.x + clip.width, &minClipX, &maxClipX);
+ MinMax(clip.y, clip.y + clip.height, &minClipY, &maxClipY);
+
+ if (minSourceX >= maxClipX || maxSourceX <= minClipX || minSourceY >= maxClipY || maxSourceY <= minClipY)
+ {
+ if (intersection)
+ {
+ intersection->x = minSourceX;
+ intersection->y = maxSourceY;
+ intersection->width = maxSourceX - minSourceX;
+ intersection->height = maxSourceY - minSourceY;
+ }
+
+ return false;
+ }
+ else
+ {
+ if (intersection)
+ {
+ intersection->x = std::max(minSourceX, minClipX);
+ intersection->y = std::max(minSourceY, minClipY);
+ intersection->width = std::min(maxSourceX, maxClipX) - std::max(minSourceX, minClipX);
+ intersection->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 &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 &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 < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ int semanticIndex = programBinary->getSemanticIndex(attributeIndex);
+
+ if (semanticIndex != -1)
+ {
+ inputLayout[semanticIndex] = VertexFormat(attributes[attributeIndex], currentValues[attributeIndex].Type);
+ }
+ }
+}
+
+bool VertexFormat::operator==(const VertexFormat &other) const
+{
+ return (mType == other.mType &&
+ mComponents == other.mComponents &&
+ mNormalized == other.mNormalized &&
+ mPureInteger == other.mPureInteger );
+}
+
+bool VertexFormat::operator!=(const VertexFormat &other) const
+{
+ return !(*this == other);
+}
+
+bool VertexFormat::operator<(const VertexFormat& other) const
+{
+ if (mType != other.mType)
+ {
+ return mType < other.mType;
+ }
+ if (mNormalized != other.mNormalized)
+ {
+ return mNormalized < other.mNormalized;
+ }
+ if (mComponents != other.mComponents)
+ {
+ return mComponents < other.mComponents;
+ }
+ return mPureInteger < other.mPureInteger;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2angletypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -9,13 +9,22 @@
</span><span class="cx"> #ifndef LIBGLESV2_ANGLETYPES_H_
</span><span class="cx"> #define LIBGLESV2_ANGLETYPES_H_
</span><span class="cx">
</span><ins>+#include "libGLESv2/constants.h"
+#include "common/RefCountObject.h"
+
</ins><span class="cx"> namespace gl
</span><span class="cx"> {
</span><ins>+class Buffer;
+class ProgramBinary;
+class VertexAttribute;
+struct VertexAttribCurrentValueData;
</ins><span class="cx">
</span><span class="cx"> enum TextureType
</span><span class="cx"> {
</span><span class="cx"> TEXTURE_2D,
</span><span class="cx"> TEXTURE_CUBE,
</span><ins>+ TEXTURE_3D,
+ TEXTURE_2D_ARRAY,
</ins><span class="cx">
</span><span class="cx"> TEXTURE_TYPE_COUNT,
</span><span class="cx"> TEXTURE_UNKNOWN
</span><span class="lines">@@ -27,22 +36,58 @@
</span><span class="cx"> SAMPLER_VERTEX
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template <typename T>
</ins><span class="cx"> struct Color
</span><span class="cx"> {
</span><del>- float red;
- float green;
- float blue;
- float alpha;
</del><ins>+ 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) { }
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+typedef Color<float> ColorF;
+typedef Color<int> ColorI;
+typedef Color<unsigned int> ColorUI;
+
</ins><span class="cx"> struct Rectangle
</span><span class="cx"> {
</span><span class="cx"> int x;
</span><span class="cx"> int y;
</span><span class="cx"> int width;
</span><span class="cx"> int height;
</span><ins>+
+ 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) { }
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+bool ClipRectangle(const Rectangle &source, const Rectangle &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_) { }
+};
+
</ins><span class="cx"> struct RasterizerState
</span><span class="cx"> {
</span><span class="cx"> bool cullFace;
</span><span class="lines">@@ -55,6 +100,8 @@
</span><span class="cx">
</span><span class="cx"> bool pointDrawMode;
</span><span class="cx"> bool multiSample;
</span><ins>+
+ bool rasterizerDiscard;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct BlendState
</span><span class="lines">@@ -104,26 +151,121 @@
</span><span class="cx"> GLenum magFilter;
</span><span class="cx"> GLenum wrapS;
</span><span class="cx"> GLenum wrapT;
</span><ins>+ GLenum wrapR;
</ins><span class="cx"> float maxAnisotropy;
</span><del>- int lodOffset;
</del><ins>+
+ GLint baseLevel;
+ GLint maxLevel;
+ GLfloat minLod;
+ GLfloat maxLod;
+
+ GLenum compareMode;
+ GLenum compareFunc;
+
+ GLenum swizzleRed;
+ GLenum swizzleGreen;
+ GLenum swizzleBlue;
+ GLenum swizzleAlpha;
+
+ bool swizzleRequired() const;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct ClearParameters
</span><span class="cx"> {
</span><del>- GLbitfield mask;
-
- Color colorClearValue;
</del><ins>+ bool clearColor[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
+ ColorF colorFClearValue;
+ ColorI colorIClearValue;
+ ColorUI colorUIClearValue;
+ GLenum colorClearType;
</ins><span class="cx"> bool colorMaskRed;
</span><span class="cx"> bool colorMaskGreen;
</span><span class="cx"> bool colorMaskBlue;
</span><span class="cx"> bool colorMaskAlpha;
</span><span class="cx">
</span><ins>+ bool clearDepth;
</ins><span class="cx"> float depthClearValue;
</span><span class="cx">
</span><ins>+ bool clearStencil;
</ins><span class="cx"> GLint stencilClearValue;
</span><span class="cx"> GLuint stencilWriteMask;
</span><ins>+
+ bool scissorEnabled;
+ Rectangle scissor;
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+struct PixelUnpackState
+{
+ BindingPointer<Buffer> pixelBuffer;
+ GLint alignment;
+
+ PixelUnpackState()
+ : alignment(4)
+ {}
+
+ explicit PixelUnpackState(GLint alignmentIn)
+ : alignment(alignmentIn)
+ {}
+};
+
+struct PixelPackState
+{
+ BindingPointer<Buffer> 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 &attribute);
+ VertexFormat(const VertexAttribute &attribute, GLenum currentValueType);
+
+ static void GetInputLayout(VertexFormat *inputLayout,
+ ProgramBinary *programBinary,
+ const VertexAttribute *attributes,
+ const gl::VertexAttribCurrentValueData *currentValues);
+
+ bool operator==(const VertexFormat &other) const;
+ bool operator!=(const VertexFormat &other) const;
+ bool operator<(const VertexFormat& other) const;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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
+};
+
+}
+
</ins><span class="cx"> #endif // LIBGLESV2_ANGLETYPES_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2formatutilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,1812 @@
</span><ins>+#include "precompiled.h"
+//
+// 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 "common/mathutil.h"
+#include "libGLESv2/formatutils.h"
+#include "libGLESv2/Context.h"
+#include "libGLESv2/Framebuffer.h"
+#include "libGLESv2/renderer/Renderer.h"
+#include "libGLESv2/renderer/imageformats.h"
+#include "libGLESv2/renderer/copyimage.h"
+
+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<GLenum, GLenum> FormatTypePair;
+typedef std::pair<FormatTypePair, FormatTypeInfo> FormatPair;
+typedef std::map<FormatTypePair, FormatTypeInfo> 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->insert(FormatPair(FormatTypePair(format, type), FormatTypeInfo(internalFormat, writeFunc)));
+}
+
+FormatMap BuildES2FormatMap()
+{
+ FormatMap map;
+
+ using namespace rx;
+
+ // | Format | Type | Internal format | Color write function |
+ InsertFormatMapping(&map, GL_ALPHA, GL_UNSIGNED_BYTE, GL_ALPHA8_EXT, WriteColor<A8, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_FLOAT, GL_ALPHA32F_EXT, WriteColor<A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_HALF_FLOAT_OES, GL_ALPHA16F_EXT, WriteColor<A16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LUMINANCE8_EXT, WriteColor<L8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_FLOAT, GL_LUMINANCE32F_EXT, WriteColor<L32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_LUMINANCE16F_EXT, WriteColor<L16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE8_ALPHA8_EXT, WriteColor<L8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, WriteColor<L32A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_LUMINANCE_ALPHA16F_EXT, WriteColor<L16A16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RED, GL_UNSIGNED_BYTE, GL_R8_EXT, WriteColor<R8, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_FLOAT, GL_R32F_EXT, WriteColor<R32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_HALF_FLOAT_OES, GL_R16F_EXT, WriteColor<R16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RG, GL_UNSIGNED_BYTE, GL_RG8_EXT, WriteColor<R8G8, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_FLOAT, GL_RG32F_EXT, WriteColor<R32G32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_HALF_FLOAT_OES, GL_RG16F_EXT, WriteColor<R16G16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB8_OES, WriteColor<R8G8B8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB565, WriteColor<R5G6B5, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_FLOAT, GL_RGB32F_EXT, WriteColor<R32G32B32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_HALF_FLOAT_OES, GL_RGB16F_EXT, WriteColor<R16G16B16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA8_OES, WriteColor<R8G8B8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_RGBA4, WriteColor<R4G4B4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_RGB5_A1, WriteColor<R5G5B5A1, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_FLOAT, GL_RGBA32F_EXT, WriteColor<R32G32B32A32F, GLfloat>);
+ InsertFormatMapping(&map, GL_RGBA, GL_HALF_FLOAT_OES, GL_RGBA16F_EXT, WriteColor<R16G16B16A16F, GLfloat>);
+
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_BGRA8_EXT, WriteColor<B8G8R8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_BGRA4_ANGLEX, WriteColor<B4G4R4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_BGR5_A1_ANGLEX, WriteColor<B5G5R5A1, GLfloat> );
+
+ InsertFormatMapping(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, NULL );
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, NULL );
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, NULL );
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, NULL );
+
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_DEPTH_COMPONENT16, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_DEPTH_COMPONENT32_OES, NULL );
+
+ InsertFormatMapping(&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(&map, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA8, WriteColor<R8G8B8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_BYTE, GL_RGBA8_SNORM, WriteColor<R8G8B8A8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_RGBA4, WriteColor<R4G4B4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_RGB5_A1, WriteColor<R5G5B5A1, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_RGB10_A2, WriteColor<R10G10B10A2, GLfloat> );
+ InsertFormatMapping(&map, GL_RGBA, GL_FLOAT, GL_RGBA32F, WriteColor<R32G32B32A32F, GLfloat>);
+ InsertFormatMapping(&map, GL_RGBA, GL_HALF_FLOAT, GL_RGBA16F, WriteColor<R16G16B16A16F, GLfloat>);
+
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_RGBA8UI, WriteColor<R8G8B8A8, GLuint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_BYTE, GL_RGBA8I, WriteColor<R8G8B8A8S, GLint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_RGBA16UI, WriteColor<R16G16B16A16, GLuint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_SHORT, GL_RGBA16I, WriteColor<R16G16B16A16S, GLint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_RGBA32UI, WriteColor<R32G32B32A32, GLuint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_INT, GL_RGBA32I, WriteColor<R32G32B32A32S, GLint> );
+ InsertFormatMapping(&map, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_RGB10_A2UI, WriteColor<R10G10B10A2, GLuint> );
+
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB8, WriteColor<R8G8B8, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_BYTE, GL_RGB8_SNORM, WriteColor<R8G8B8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB565, WriteColor<R5G6B5, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_R11F_G11F_B10F, WriteColor<R11G11B10F, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_RGB9_E5, WriteColor<R9G9B9E5, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_FLOAT, GL_RGB32F, WriteColor<R32G32B32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RGB, GL_HALF_FLOAT, GL_RGB16F, WriteColor<R16G16B16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_RGB8UI, WriteColor<R8G8B8, GLuint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_BYTE, GL_RGB8I, WriteColor<R8G8B8S, GLint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_RGB16UI, WriteColor<R16G16B16, GLuint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_SHORT, GL_RGB16I, WriteColor<R16G16B16S, GLint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_RGB32UI, WriteColor<R32G32B32, GLuint> );
+ InsertFormatMapping(&map, GL_RGB_INTEGER, GL_INT, GL_RGB32I, WriteColor<R32G32B32S, GLint> );
+
+ InsertFormatMapping(&map, GL_RG, GL_UNSIGNED_BYTE, GL_RG8, WriteColor<R8G8, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_BYTE, GL_RG8_SNORM, WriteColor<R8G8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_FLOAT, GL_RG32F, WriteColor<R32G32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RG, GL_HALF_FLOAT, GL_RG16F, WriteColor<R16G16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_RG8UI, WriteColor<R8G8, GLuint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_BYTE, GL_RG8I, WriteColor<R8G8S, GLint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_RG16UI, WriteColor<R16G16, GLuint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_SHORT, GL_RG16I, WriteColor<R16G16S, GLint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_RG32UI, WriteColor<R32G32, GLuint> );
+ InsertFormatMapping(&map, GL_RG_INTEGER, GL_INT, GL_RG32I, WriteColor<R32G32S, GLint> );
+
+ InsertFormatMapping(&map, GL_RED, GL_UNSIGNED_BYTE, GL_R8, WriteColor<R8, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_BYTE, GL_R8_SNORM, WriteColor<R8S, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_FLOAT, GL_R32F, WriteColor<R32F, GLfloat> );
+ InsertFormatMapping(&map, GL_RED, GL_HALF_FLOAT, GL_R16F, WriteColor<R16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_R8UI, WriteColor<R8, GLuint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_BYTE, GL_R8I, WriteColor<R8S, GLint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_R16UI, WriteColor<R16, GLuint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_SHORT, GL_R16I, WriteColor<R16S, GLint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_R32UI, WriteColor<R32, GLuint> );
+ InsertFormatMapping(&map, GL_RED_INTEGER, GL_INT, GL_R32I, WriteColor<R32S, GLint> );
+
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE8_ALPHA8_EXT, WriteColor<L8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LUMINANCE8_EXT, WriteColor<L8, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_UNSIGNED_BYTE, GL_ALPHA8_EXT, WriteColor<A8, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, WriteColor<L32A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_FLOAT, GL_LUMINANCE32F_EXT, WriteColor<L32F, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_FLOAT, GL_ALPHA32F_EXT, WriteColor<A32F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, GL_LUMINANCE_ALPHA16F_EXT, WriteColor<L16A16F, GLfloat> );
+ InsertFormatMapping(&map, GL_LUMINANCE, GL_HALF_FLOAT, GL_LUMINANCE16F_EXT, WriteColor<L16F, GLfloat> );
+ InsertFormatMapping(&map, GL_ALPHA, GL_HALF_FLOAT, GL_ALPHA16F_EXT, WriteColor<A16F, GLfloat> );
+
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_BGRA8_EXT, WriteColor<B8G8R8A8, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_BGRA4_ANGLEX, WriteColor<B4G4R4A4, GLfloat> );
+ InsertFormatMapping(&map, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_BGR5_A1_ANGLEX, WriteColor<B5G5R5A1, GLfloat> );
+
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_DEPTH_COMPONENT16, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_DEPTH_COMPONENT24, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F, NULL );
+
+ InsertFormatMapping(&map, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8, NULL );
+ InsertFormatMapping(&map, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_DEPTH32F_STENCIL8, NULL );
+
+ return map;
+}
+
+static const FormatMap &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<(const FormatInfo& other) const
+ {
+ return memcmp(this, &other, sizeof(FormatInfo)) < 0;
+ }
+};
+
+// ES3 has a specific set of permutations of internal formats, formats and types which are acceptable.
+typedef std::set<FormatInfo> 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 &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<(const TypeInfo& other) const
+ {
+ return memcmp(this, &other, sizeof(TypeInfo)) < 0;
+ }
+};
+
+typedef std::pair<GLenum, TypeInfo> TypeInfoPair;
+typedef std::map<GLenum, TypeInfo> 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->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 <ContextSupportCheckMemberFunction func>
+bool CheckSupport(const Context *context)
+{
+ return (context->*func)();
+}
+
+template <ContextSupportCheckMemberFunction contextFunc, RendererSupportCheckMemberFunction rendererFunc>
+bool CheckSupport(const Context *context, const rx::Renderer *renderer)
+{
+ if (context)
+ {
+ return (context->*contextFunc)();
+ }
+ else if (renderer)
+ {
+ return (renderer->*rendererFunc)();
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+template <typename objectType>
+bool AlwaysSupported(const objectType*)
+{
+ return true;
+}
+
+template <typename objectTypeA, typename objectTypeB>
+bool AlwaysSupported(const objectTypeA*, const objectTypeB*)
+{
+ return true;
+}
+
+template <typename objectType>
+bool NeverSupported(const objectType*)
+{
+ return false;
+}
+
+template <typename objectTypeA, typename objectTypeB>
+bool NeverSupported(const objectTypeA *, const objectTypeB *)
+{
+ return false;
+}
+
+template <typename objectType>
+bool UnimplementedSupport(const objectType*)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+template <typename objectTypeA, typename objectTypeB>
+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 > 0) ? 1 : 0) + ((green > 0) ? 1 : 0) + ((blue > 0) ? 1 : 0) + ((alpha > 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 > 0) ? 1 : 0) + ((alpha > 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 > 0) ? 1 : 0) + ((stencilBits > 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<GLenum, InternalFormatInfo> InternalFormatInfoPair;
+typedef std::map<GLenum, InternalFormatInfo> 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<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG16F, InternalFormatInfo::RGBAFormat(16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB16F, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA16F, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_R32F, InternalFormatInfo::RGBAFormat(32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RG32F, InternalFormatInfo::RGBAFormat(32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGB32F, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, AlwaysSupported )));
+ map.insert(InternalFormatInfoPair(GL_RGBA32F, InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, 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<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures>)));
+ map.insert(InternalFormatInfoPair(GL_RG8_EXT, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures>)));
+ 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<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_R32F_EXT, InternalFormatInfo::RGBAFormat(32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_RG16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_RG32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
+ map.insert(InternalFormatInfoPair(GL_RGB16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>)));
+ map.insert(InternalFormatInfoPair(GL_RGB32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, CheckSupport<&Context::supportsFloat32Textures>)));
+ map.insert(InternalFormatInfoPair(GL_RGBA16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>)));
+ map.insert(InternalFormatInfoPair(GL_RGBA32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, CheckSupport<&Context::supportsFloat32Textures>)));
+
+ // 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<&Context::supportsDepthTextures>)));
+ 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<&Context::supportsDepthTextures>)));
+ 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<&Context::supportsRGTextures>)));
+ map.insert(InternalFormatInfoPair(GL_RG_EXT, InternalFormatInfo::UnsizedFormat(GL_RG_EXT, CheckSupport<&Context::supportsRGTextures>)));
+ 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<&Context::supportsDXT1Textures>)));
+ 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<&Context::supportsDXT1Textures>)));
+
+ // 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<&Context::supportsDXT3Textures>)));
+
+ // 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<&Context::supportsDXT5Textures>)));
+
+ return map;
+}
+
+static bool GetInternalFormatInfo(GLenum internalFormat, GLuint clientVersion, InternalFormatInfo *outFormatInfo)
+{
+ const InternalFormatInfoMap* map = NULL;
+
+ if (clientVersion == 2)
+ {
+ static const InternalFormatInfoMap formatMap = BuildES2InternalFormatInfoMap();
+ map = &formatMap;
+ }
+ else if (clientVersion == 3)
+ {
+ static const InternalFormatInfoMap formatMap = BuildES3InternalFormatInfoMap();
+ map = &formatMap;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ InternalFormatInfoMap::const_iterator iter = map->find(internalFormat);
+ if (iter != map->end())
+ {
+ if (outFormatInfo)
+ {
+ *outFormatInfo = iter->second;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+typedef std::set<GLenum> FormatSet;
+
+static FormatSet BuildES2ValidFormatSet()
+{
+ static const FormatMap &formatMap = GetFormatMap(2);
+
+ FormatSet set;
+
+ for (FormatMap::const_iterator i = formatMap.begin(); i != formatMap.end(); i++)
+ {
+ const FormatTypePair& formatPair = i->first;
+ set.insert(formatPair.first);
+ }
+
+ return set;
+}
+
+static FormatSet BuildES3ValidFormatSet()
+{
+ static const ES3FormatSet &formatSet = GetES3FormatSet();
+
+ FormatSet set;
+
+ for (ES3FormatSet::const_iterator i = formatSet.begin(); i != formatSet.end(); i++)
+ {
+ const FormatInfo& formatInfo = *i;
+ set.insert(formatInfo.mFormat);
+ }
+
+ return set;
+}
+
+typedef std::set<GLenum> TypeSet;
+
+static TypeSet BuildES2ValidTypeSet()
+{
+ static const FormatMap &formatMap = GetFormatMap(2);
+
+ TypeSet set;
+
+ for (FormatMap::const_iterator i = formatMap.begin(); i != formatMap.end(); i++)
+ {
+ const FormatTypePair& formatPair = i->first;
+ set.insert(formatPair.second);
+ }
+
+ return set;
+}
+
+static TypeSet BuildES3ValidTypeSet()
+{
+ static const ES3FormatSet &formatSet = GetES3FormatSet();
+
+ TypeSet set;
+
+ for (ES3FormatSet::const_iterator i = formatSet.begin(); i != formatSet.end(); i++)
+ {
+ const FormatInfo& 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<EffectiveInternalFormatInfo> 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 &srcFormat, const InternalFormatInfo &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 = &sizedList;
+ }
+ else
+ {
+ static const EffectiveInternalFormatList unsizedList = BuildUnsizedEffectiveInternalFormatList();
+ list = &unsizedList;
+ targetFormat = destFormat.mFormat;
+ }
+
+ for (size_t curFormat = 0; curFormat < list->size(); ++curFormat)
+ {
+ const EffectiveInternalFormatInfo& formatInfo = list->at(curFormat);
+ if ((formatInfo.mDestFormat == targetFormat) &&
+ (formatInfo.mMinRedBits <= srcFormat.mRedBits && formatInfo.mMaxRedBits >= srcFormat.mRedBits) &&
+ (formatInfo.mMinGreenBits <= srcFormat.mGreenBits && formatInfo.mMaxGreenBits >= srcFormat.mGreenBits) &&
+ (formatInfo.mMinBlueBits <= srcFormat.mBlueBits && formatInfo.mMaxBlueBits >= srcFormat.mBlueBits) &&
+ (formatInfo.mMinAlphaBits <= srcFormat.mAlphaBits && formatInfo.mMaxAlphaBits >= 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<(const CopyConversion& other) const
+ {
+ return memcmp(this, &other, sizeof(CopyConversion)) < 0;
+ }
+};
+
+typedef std::set<CopyConversion> 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->getClientVersion(), &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 &formats = GetFormatMap(clientVersion);
+ FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
+
+ return (iter != formats.end()) && ((internalFormat == (GLint)type) || (internalFormat == iter->second.mInternalFormat));
+ }
+ else if (clientVersion == 3)
+ {
+ static const ES3FormatSet &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, &textureInternalFormatInfo) &&
+ GetInternalFormatInfo(frameBufferInternalFormat, clientVersion, &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) &&
+ !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 <format> and <type> 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, &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, &effectiveFormat))
+ {
+ gl::GetInternalFormatInfo(effectiveFormat, clientVersion, &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) &&
+ (framebufferInternalFormatInfo.mRedBits >= 1 && framebufferInternalFormatInfo.mRedBits <= 8) &&
+ (framebufferInternalFormatInfo.mGreenBits >= 1 && framebufferInternalFormatInfo.mGreenBits <= 8) &&
+ (framebufferInternalFormatInfo.mBlueBits >= 1 && framebufferInternalFormatInfo.mBlueBits <= 8) &&
+ (framebufferInternalFormatInfo.mAlphaBits >= 1 && framebufferInternalFormatInfo.mAlphaBits <= 8))
+ {
+ gl::GetInternalFormatInfo(GL_SRGB8_ALPHA8, clientVersion, &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, &internalFormatInfo))
+ {
+ return internalFormatInfo.mPixelBits > 0;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion)
+{
+ const FormatMap &formats = GetFormatMap(clientVersion);
+ FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
+ return (iter != formats.end()) ? iter->second.mInternalFormat : GL_NONE;
+}
+
+GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mPixelBits / 8;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mAlphaBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mRedBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mGreenBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mBlueBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mLuminanceBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mDepthBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mStencilBits;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetTypeBytes(GLenum type)
+{
+ TypeInfo typeInfo;
+ if (GetTypeInfo(type, &typeInfo))
+ {
+ return typeInfo.mTypeBytes;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+bool IsSpecialInterpretationType(GLenum type)
+{
+ TypeInfo typeInfo;
+ if (GetTypeInfo(type, &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, &internalFormatInfo))
+ {
+ return internalFormatInfo.mFormat;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLenum GetType(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mType;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mComponentType;
+ }
+ else
+ {
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mComponentCount;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mColorEncoding;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsColorRenderable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsColorRenderingSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsColorRenderable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsTextureFilterable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsTextureFilterable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsDepthRenderable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsDepthRenderable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsStencilRenderable(NULL, renderer);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsStencilRenderable(context, NULL);
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment)
+{
+ ASSERT(alignment > 0 && isPow2(alignment));
+ return rx::roundUp(GetBlockSize(internalFormat, type, clientVersion, width, 1), static_cast<GLuint>(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, &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, &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, &internalFormatInfo))
+ {
+ return internalFormatInfo.mIsCompressed;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+}
+
+GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mCompressedBlockWidth;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion)
+{
+ InternalFormatInfo internalFormatInfo;
+ if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
+ {
+ return internalFormatInfo.mCompressedBlockHeight;
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion)
+{
+ static const FormatMap &formats = GetFormatMap(clientVersion);
+ FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
+ return (iter != formats.end()) ? iter->second.mColorWriteFunction : NULL;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2formatutilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,99 @@
</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 LIBGLESV2_FORMATUTILS_H_
+#define LIBGLESV2_FORMATUTILS_H_
+
+#define GL_APICALL
+#include <GLES3/gl3.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include "libGLESv2/angletypes.h"
+
+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_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 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">@@ -10,7 +10,8 @@
</span><span class="cx"> #include "common/version.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/main.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
+#include "libGLESv2/formatutils.h"
</ins><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx"> #include "libGLESv2/Fence.h"
</span><span class="cx"> #include "libGLESv2/Framebuffer.h"
</span><span class="lines">@@ -20,242 +21,19 @@
</span><span class="cx"> #include "libGLESv2/Texture.h"
</span><span class="cx"> #include "libGLESv2/Query.h"
</span><span class="cx"> #include "libGLESv2/Context.h"
</span><ins>+#include "libGLESv2/VertexArray.h"
+#include "libGLESv2/TransformFeedback.h"
</ins><span class="cx">
</span><del>-bool validImageSize(GLint level, GLsizei width, GLsizei height)
-{
- if (level < 0 || width < 0 || height < 0)
- {
- return false;
- }
</del><ins>+#include "libGLESv2/validationES.h"
+#include "libGLESv2/validationES2.h"
+#include "libGLESv2/validationES3.h"
+#include "libGLESv2/queryconversions.h"
</ins><span class="cx">
</span><del>- if (gl::getContext() && gl::getContext()->supportsNonPower2Texture())
- {
- return true;
- }
-
- if (level == 0)
- {
- return true;
- }
-
- if (gl::isPow2(width) && gl::isPow2(height))
- {
- return true;
- }
-
- return false;
-}
-
-// Verify that format/type are one of the combinations from table 3.4.
-bool checkTextureFormatType(GLenum format, GLenum type)
</del><ins>+extern "C"
</ins><span class="cx"> {
</span><del>- // validate <format> by itself (used as secondary key below)
- switch (format)
- {
- case GL_RGBA:
- case GL_BGRA_EXT:
- case GL_RGB:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- break;
- default:
- return gl::error(GL_INVALID_ENUM, false);
- }
</del><span class="cx">
</span><del>- // invalid <type> -> sets INVALID_ENUM
- // invalid <format>+<type> combination -> sets INVALID_OPERATION
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- switch (format)
- {
- case GL_RGBA:
- case GL_BGRA_EXT:
- case GL_RGB:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
</del><ins>+// OpenGL ES 2.0 functions
</ins><span class="cx">
</span><del>- case GL_FLOAT:
- case GL_HALF_FLOAT_OES:
- switch (format)
- {
- case GL_RGBA:
- case GL_RGB:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- switch (format)
- {
- case GL_RGBA:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_SHORT_5_6_5:
- switch (format)
- {
- case GL_RGB:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- switch (format)
- {
- case GL_DEPTH_COMPONENT:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- case GL_UNSIGNED_INT_24_8_OES:
- switch (format)
- {
- case GL_DEPTH_STENCIL_OES:
- return true;
- default:
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- default:
- return gl::error(GL_INVALID_ENUM, false);
- }
-}
-
-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->isCompressed(level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- if (format != GL_NONE)
- {
- GLenum internalformat = gl::ConvertSizedInternalFormat(format, type);
- if (internalformat != texture->getInternalFormat(level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (compressed)
- {
- if ((width % 4 != 0 && width != texture->getWidth(0)) ||
- (height % 4 != 0 && height != texture->getHeight(0)))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (xoffset + width > texture->getWidth(level) ||
- yoffset + height > texture->getHeight(level))
- {
- return gl::error(GL_INVALID_VALUE, false);
- }
-
- return true;
-}
-
-bool validateSubImageParamsCube(bool compressed, GLsizei width, GLsizei height,
- GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, GLenum type,
- gl::TextureCubeMap *texture)
-{
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- if (compressed != texture->isCompressed(target, level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
-
- if (format != GL_NONE)
- {
- GLenum internalformat = gl::ConvertSizedInternalFormat(format, type);
- if (internalformat != texture->getInternalFormat(target, level))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (compressed)
- {
- if ((width % 4 != 0 && width != texture->getWidth(target, 0)) ||
- (height % 4 != 0 && height != texture->getHeight(target, 0)))
- {
- return gl::error(GL_INVALID_OPERATION, false);
- }
- }
-
- if (xoffset + width > texture->getWidth(target, level) ||
- yoffset + height > texture->getHeight(target, level))
- {
- return gl::error(GL_INVALID_VALUE, false);
- }
-
- return true;
-}
-
-// check for combinations of format and type that are valid for ReadPixels
-bool validReadFormatType(GLenum format, GLenum type)
-{
- switch (format)
- {
- case GL_RGBA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- break;
- default:
- return false;
- }
- break;
- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- break;
- default:
- return false;
- }
- break;
- default:
- return false;
- }
- return true;
-}
-
-extern "C"
-{
-
</del><span class="cx"> void __stdcall glActiveTexture(GLenum texture)
</span><span class="cx"> {
</span><span class="cx"> EVENT("(GLenum texture = 0x%X)", texture);
</span><span class="lines">@@ -335,24 +113,20 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
</del><ins>+ gl::Context *context = gl::getNonLostContext();
</ins><span class="cx">
</span><del>- if (id == 0)
</del><ins>+ if (context)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
- }
</del><ins>+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
</ins><span class="cx">
</span><del>- gl::Context *context = gl::getNonLostContext();
</del><ins>+ if (id == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
</ins><span class="cx">
</span><del>- if (context)
- {
</del><span class="cx"> context->beginQuery(target, id);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -415,6 +189,11 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
</ins><span class="cx"> switch (target)
</span><span class="cx"> {
</span><span class="cx"> case GL_ARRAY_BUFFER:
</span><span class="lines">@@ -423,6 +202,24 @@
</span><span class="cx"> case GL_ELEMENT_ARRAY_BUFFER:
</span><span class="cx"> context->bindElementArrayBuffer(buffer);
</span><span class="cx"> return;
</span><ins>+ case GL_COPY_READ_BUFFER:
+ context->bindCopyReadBuffer(buffer);
+ return;
+ case GL_COPY_WRITE_BUFFER:
+ context->bindCopyWriteBuffer(buffer);
+ return;
+ case GL_PIXEL_PACK_BUFFER:
+ context->bindPixelPackBuffer(buffer);
+ return;
+ case GL_PIXEL_UNPACK_BUFFER:
+ context->bindPixelUnpackBuffer(buffer);
+ return;
+ case GL_UNIFORM_BUFFER:
+ context->bindGenericUniformBuffer(buffer);
+ return;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ return;
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -440,7 +237,7 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
</del><ins>+ if (!gl::ValidFramebufferTarget(target))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -515,6 +312,20 @@
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP:
</span><span class="cx"> context->bindTextureCubeMap(texture);
</span><span class="cx"> return;
</span><ins>+ case GL_TEXTURE_3D:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ context->bindTexture3D(texture);
+ return;
+ case GL_TEXTURE_2D_ARRAY:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ context->bindTexture2DArray(texture);
+ return;
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -557,12 +368,17 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><ins>+ gl::Context *context = gl::getNonLostContext();
+
</ins><span class="cx"> switch (modeRGB)
</span><span class="cx"> {
</span><span class="cx"> case GL_FUNC_ADD:
</span><span class="cx"> case GL_FUNC_SUBTRACT:
</span><span class="cx"> case GL_FUNC_REVERSE_SUBTRACT:
</span><ins>+ case GL_MIN:
+ case GL_MAX:
</ins><span class="cx"> break;
</span><ins>+
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -572,13 +388,14 @@
</span><span class="cx"> case GL_FUNC_ADD:
</span><span class="cx"> case GL_FUNC_SUBTRACT:
</span><span class="cx"> case GL_FUNC_REVERSE_SUBTRACT:
</span><ins>+ case GL_MIN:
+ case GL_MAX:
</ins><span class="cx"> break;
</span><ins>+
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Context *context = gl::getNonLostContext();
-
</del><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> context->setBlendEquation(modeRGB, modeAlpha);
</span><span class="lines">@@ -602,6 +419,8 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><ins>+ gl::Context *context = gl::getNonLostContext();
+
</ins><span class="cx"> switch (srcRGB)
</span><span class="cx"> {
</span><span class="cx"> case GL_ZERO:
</span><span class="lines">@@ -641,6 +460,14 @@
</span><span class="cx"> case GL_CONSTANT_ALPHA:
</span><span class="cx"> case GL_ONE_MINUS_CONSTANT_ALPHA:
</span><span class="cx"> break;
</span><ins>+
+ case GL_SRC_ALPHA_SATURATE:
+ if (!context || context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -684,6 +511,14 @@
</span><span class="cx"> case GL_CONSTANT_ALPHA:
</span><span class="cx"> case GL_ONE_MINUS_CONSTANT_ALPHA:
</span><span class="cx"> break;
</span><ins>+
+ case GL_SRC_ALPHA_SATURATE:
+ if (!context || context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -700,8 +535,6 @@
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Context *context = gl::getNonLostContext();
-
</del><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> context->setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
</span><span class="lines">@@ -725,34 +558,40 @@
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::Context *context = gl::getNonLostContext();
+
</ins><span class="cx"> switch (usage)
</span><span class="cx"> {
</span><span class="cx"> case GL_STREAM_DRAW:
</span><span class="cx"> case GL_STATIC_DRAW:
</span><span class="cx"> case GL_DYNAMIC_DRAW:
</span><span class="cx"> break;
</span><ins>+
+ 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 && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Context *context = gl::getNonLostContext();
-
</del><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Buffer *buffer;
-
- switch (target)
</del><ins>+ if (!gl::ValidBufferTarget(context, target))
</ins><span class="cx"> {
</span><del>- case GL_ARRAY_BUFFER:
- buffer = context->getArrayBuffer();
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- buffer = context->getElementArrayBuffer();
- break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
</ins><span class="cx"> if (!buffer)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="lines">@@ -788,25 +627,23 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Buffer *buffer;
-
- switch (target)
</del><ins>+ if (!gl::ValidBufferTarget(context, target))
</ins><span class="cx"> {
</span><del>- case GL_ARRAY_BUFFER:
- buffer = context->getArrayBuffer();
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- buffer = context->getElementArrayBuffer();
- break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
</ins><span class="cx"> if (!buffer)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
</ins><span class="cx"> if ((size_t)size + offset > buffer->size())
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="lines">@@ -827,7 +664,7 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
</del><ins>+ if (!gl::ValidFramebufferTarget(target))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_ENUM, 0);
</span><span class="cx"> }
</span><span class="lines">@@ -836,16 +673,8 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Framebuffer *framebuffer = NULL;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
- {
- framebuffer = context->getReadFramebuffer();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- }
-
</del><ins>+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
+ ASSERT(framebuffer);
</ins><span class="cx"> return framebuffer->completeness();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -859,7 +688,7 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glClear(GLbitfield mask)
</span><span class="cx"> {
</span><del>- EVENT("(GLbitfield mask = %X)", mask);
</del><ins>+ EVENT("(GLbitfield mask = 0x%X)", mask);
</ins><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><span class="lines">@@ -867,6 +696,18 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ gl::Framebuffer *framebufferObject = context->getDrawFramebuffer();
+
+ if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
+ {
+ return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
+ }
+
+ if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
</ins><span class="cx"> context->clear(mask);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -936,7 +777,7 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
</span><span class="cx"> {
</span><del>- EVENT("(GLboolean red = %d, GLboolean green = %d, GLboolean blue = %d, GLboolean alpha = %d)",
</del><ins>+ EVENT("(GLboolean red = %d, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)",
</ins><span class="cx"> red, green, blue, alpha);
</span><span class="cx">
</span><span class="cx"> try
</span><span class="lines">@@ -996,149 +837,54 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (!validImageSize(level, width, height) || border != 0 || imageSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (internalformat)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (border != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (width != 1 && width != 2 && width % 4 != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (height != 1 && height != 2 && height % 4 != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (level > context->getMaximumTextureLevel())
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, width, height, 0, GL_NONE, GL_NONE, data))
</ins><span class="cx"> {
</span><ins>+ return;
+ }
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, context->getClientVersion(), width, height))
+ {
</ins><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> switch (target)
</span><span class="cx"> {
</span><span class="cx"> case GL_TEXTURE_2D:
</span><del>- if (width > (context->getMaximumTextureDimension() >> level) ||
- height > (context->getMaximumTextureDimension() >> level))
</del><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::Texture2D *texture = context->getTexture2D();
+ texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+
</ins><span class="cx"> case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
</span><del>- if (width != height)
</del><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
</ins><span class="cx"> }
</span><ins>+ break;
</ins><span class="cx">
</span><del>- if (width > (context->getMaximumCubeTextureDimension() >> level) ||
- height > (context->getMaximumCubeTextureDimension() >> level))
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
</del><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><del>-
- switch (internalformat) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->supportsDXT1Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->supportsDXT3Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- default: UNREACHABLE();
- }
-
- if (imageSize != gl::ComputeCompressedSize(width, height, internalformat))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
- }
- else
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (target)
- {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
- break;
- default: UNREACHABLE();
- }
- }
</del><span class="cx"> }
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="cx"> {
</span><span class="lines">@@ -1156,95 +902,53 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (!gl::IsInternalTextureTarget(target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (xoffset < 0 || yoffset < 0 || !validImageSize(level, width, height) || imageSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (format)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (width == 0 || height == 0 || data == NULL)
- {
- return;
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (level > context->getMaximumTextureLevel())
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true,
+ xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- switch (format) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->supportsDXT1Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->supportsDXT3Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_ENUM); // in this case, it's as though the internal format switch failed
- }
- break;
- default: UNREACHABLE();
</del><ins>+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
+ xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
+ {
+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (imageSize != gl::ComputeCompressedSize(width, height, format))
</del><ins>+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, context->getClientVersion(), width, height))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (xoffset % 4 != 0 || yoffset % 4 != 0)
</del><ins>+ switch (target)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION); // we wait to check the offsets until this point, because the multiple-of-four restriction
- // does not exist unless DXT textures are supported.
- }
-
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
- if (validateSubImageParams2D(true, width, height, xoffset, yoffset, level, format, GL_NONE, texture))
</del><ins>+ case GL_TEXTURE_2D:
</ins><span class="cx"> {
</span><ins>+ gl::Texture2D *texture = context->getTexture2D();
</ins><span class="cx"> texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
</span><span class="cx"> }
</span><del>- }
- else if (gl::IsCubemapTextureTarget(target))
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- if (validateSubImageParamsCube(true, width, height, xoffset, yoffset, target, level, format, GL_NONE, texture))
</del><ins>+ 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:
</ins><span class="cx"> {
</span><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
</ins><span class="cx"> texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
</span><span class="cx"> }
</span><ins>+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><del>- else
- {
- UNREACHABLE();
- }
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -1261,186 +965,50 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (!validImageSize(level, width, height))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (border != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (level > context->getMaximumTextureLevel())
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false,
+ 0, 0, x, y, width, height, border))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false,
+ 0, 0, 0, x, y, width, height, border))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
+
</ins><span class="cx"> switch (target)
</span><span class="cx"> {
</span><span class="cx"> case GL_TEXTURE_2D:
</span><del>- if (width > (context->getMaximumTextureDimension() >> level) ||
- height > (context->getMaximumTextureDimension() >> level))
</del><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::Texture2D *texture = context->getTexture2D();
+ texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+
</ins><span class="cx"> case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
</span><del>- if (width != height)
</del><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer);
</ins><span class="cx"> }
</span><del>-
- if (width > (context->getMaximumCubeTextureDimension() >> level) ||
- height > (context->getMaximumCubeTextureDimension() >> level))
- {
- return gl::error(GL_INVALID_VALUE);
- }
</del><span class="cx"> break;
</span><del>- default:
- return gl::error(GL_INVALID_ENUM);
- }
</del><span class="cx">
</span><del>- gl::Framebuffer *framebuffer = context->getReadFramebuffer();
-
- if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
- {
- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::Renderbuffer *source = framebuffer->getReadColorbuffer();
- GLenum colorbufferFormat = source->getInternalFormat();
-
- // [OpenGL ES 2.0.24] table 3.9
- switch (internalformat)
- {
- case GL_ALPHA:
- if (colorbufferFormat != GL_ALPHA8_EXT &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_BGRA8_EXT &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- if (colorbufferFormat != GL_RGB565 &&
- colorbufferFormat != GL_RGB8_OES &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_BGRA8_EXT &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- if (colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_BGRA8_EXT &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (context->supportsDXT1Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (context->supportsDXT3Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH_STENCIL_OES:
- case GL_DEPTH24_STENCIL8_OES:
- if (context->supportsDepthTextures())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- default:
</del><ins>+ default:
</ins><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><del>-
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
- }
- else if (gl::IsCubemapTextureTarget(target))
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer);
- }
- else UNREACHABLE();
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -1457,121 +1025,50 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (!gl::IsInternalTextureTarget(target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (width == 0 || height == 0)
- {
- return;
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (level > context->getMaximumTextureLevel())
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true,
+ xoffset, yoffset, x, y, width, height, 0))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Framebuffer *framebuffer = context->getReadFramebuffer();
-
- if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
</del><ins>+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true,
+ xoffset, yoffset, 0, x, y, width, height, 0))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><ins>+ gl::Framebuffer *framebuffer = context->getReadFramebuffer();
</ins><span class="cx">
</span><del>- gl::Renderbuffer *source = framebuffer->getReadColorbuffer();
- GLenum colorbufferFormat = source->getInternalFormat();
- gl::Texture *texture = NULL;
- GLenum textureFormat = GL_RGBA;
-
- if (target == GL_TEXTURE_2D)
</del><ins>+ switch (target)
</ins><span class="cx"> {
</span><del>- gl::Texture2D *tex2d = context->getTexture2D();
-
- if (!validateSubImageParams2D(false, width, height, xoffset, yoffset, level, GL_NONE, GL_NONE, tex2d))
</del><ins>+ case GL_TEXTURE_2D:
</ins><span class="cx"> {
</span><del>- return; // error already registered by validateSubImageParams
</del><ins>+ gl::Texture2D *texture = context->getTexture2D();
+ texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
</ins><span class="cx"> }
</span><del>- textureFormat = gl::ExtractFormat(tex2d->getInternalFormat(level));
- texture = tex2d;
- }
- else if (gl::IsCubemapTextureTarget(target))
- {
- gl::TextureCubeMap *texcube = context->getTextureCubeMap();
</del><ins>+ break;
</ins><span class="cx">
</span><del>- if (!validateSubImageParamsCube(false, width, height, xoffset, yoffset, target, level, GL_NONE, GL_NONE, texcube))
</del><ins>+ 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:
</ins><span class="cx"> {
</span><del>- return; // error already registered by validateSubImageParams
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
</ins><span class="cx"> }
</span><del>- textureFormat = gl::ExtractFormat(texcube->getInternalFormat(target, level));
- texture = texcube;
- }
- else UNREACHABLE();
</del><ins>+ break;
</ins><span class="cx">
</span><del>- // [OpenGL ES 2.0.24] table 3.9
- switch (textureFormat)
- {
- case GL_ALPHA:
- if (colorbufferFormat != GL_ALPHA8_EXT &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- if (colorbufferFormat != GL_RGB565 &&
- colorbufferFormat != GL_RGB8_OES &&
- colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- if (colorbufferFormat != GL_RGBA4 &&
- colorbufferFormat != GL_RGB5_A1 &&
- colorbufferFormat != GL_RGBA8_OES)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- return gl::error(GL_INVALID_OPERATION);
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- return gl::error(GL_INVALID_OPERATION);
</del><span class="cx"> default:
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><del>-
- texture->copySubImage(target, level, xoffset, yoffset, x, y, width, height, framebuffer);
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1704,7 +1201,7 @@
</span><span class="cx"> {
</span><span class="cx"> for (int i = 0; i < n; i++)
</span><span class="cx"> {
</span><del>- context->deleteFence(fences[i]);
</del><ins>+ context->deleteFenceNV(fences[i]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1936,7 +1433,7 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glDepthMask(GLboolean flag)
</span><span class="cx"> {
</span><del>- EVENT("(GLboolean flag = %d)", flag);
</del><ins>+ EVENT("(GLboolean flag = %u)", flag);
</ins><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><span class="lines">@@ -2035,20 +1532,12 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- switch (cap)
</del><ins>+ if (!ValidCap(context, cap))
</ins><span class="cx"> {
</span><del>- case GL_CULL_FACE: context->setCullFace(false); break;
- case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFill(false); break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(false); break;
- case GL_SAMPLE_COVERAGE: context->setSampleCoverage(false); break;
- case GL_SCISSOR_TEST: context->setScissorTest(false); break;
- case GL_STENCIL_TEST: context->setStencilTest(false); break;
- case GL_DEPTH_TEST: context->setDepthTest(false); break;
- case GL_BLEND: context->setBlend(false); break;
- case GL_DITHER: context->setDither(false); break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><ins>+
+ context->setCap(cap, false);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -2094,8 +1583,24 @@
</span><span class="cx">
</span><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><ins>+ // Check for mapped buffers
+ if (context->hasMappedBuffer(GL_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
</ins><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused() &&
+ curTransformFeedback->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);
+ }
+
</ins><span class="cx"> context->drawArrays(mode, first, count, 0);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2120,8 +1625,24 @@
</span><span class="cx"> {
</span><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><ins>+ // Check for mapped buffers
+ if (context->hasMappedBuffer(GL_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
</ins><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused() &&
+ curTransformFeedback->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);
+ }
+
</ins><span class="cx"> context->drawArrays(mode, first, count, primcount);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2156,13 +1677,27 @@
</span><span class="cx"> case GL_UNSIGNED_INT:
</span><span class="cx"> if (!context->supports32bitIndices())
</span><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_ENUM);
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><del>-
</del><ins>+
+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->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->hasMappedBuffer(GL_ARRAY_BUFFER) || context->hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
</ins><span class="cx"> context->drawElements(mode, count, type, indices, 0);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2198,13 +1733,27 @@
</span><span class="cx"> case GL_UNSIGNED_INT:
</span><span class="cx"> if (!context->supports32bitIndices())
</span><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_ENUM);
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><del>-
</del><ins>+
+ gl::TransformFeedback *curTransformFeedback = context->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->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->hasMappedBuffer(GL_ARRAY_BUFFER) || context->hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
</ins><span class="cx"> context->drawElements(mode, count, type, indices, primcount);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2225,20 +1774,12 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- switch (cap)
</del><ins>+ if (!ValidCap(context, cap))
</ins><span class="cx"> {
</span><del>- case GL_CULL_FACE: context->setCullFace(true); break;
- case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFill(true); break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverage(true); break;
- case GL_SAMPLE_COVERAGE: context->setSampleCoverage(true); break;
- case GL_SCISSOR_TEST: context->setScissorTest(true); break;
- case GL_STENCIL_TEST: context->setStencilTest(true); break;
- case GL_DEPTH_TEST: context->setDepthTest(true); break;
- case GL_BLEND: context->setBlend(true); break;
- case GL_DITHER: context->setDither(true); break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><ins>+
+ context->setCap(cap, true);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -2277,19 +1818,15 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- switch (target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
</ins><span class="cx"> context->endQuery(target);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2309,13 +1846,18 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Fence* fenceObject = context->getFence(fence);
</del><ins>+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
</ins><span class="cx">
</span><span class="cx"> if (fenceObject == NULL)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
</ins><span class="cx"> fenceObject->finishFence();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2370,8 +1912,7 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if ((target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
- || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
</del><ins>+ if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -2380,47 +1921,35 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Framebuffer *framebuffer = NULL;
- GLuint framebufferHandle = 0;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
</del><ins>+ if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer))
</ins><span class="cx"> {
</span><del>- framebuffer = context->getReadFramebuffer();
- framebufferHandle = context->getReadFramebufferHandle();
</del><ins>+ return;
</ins><span class="cx"> }
</span><del>- else
- {
- framebuffer = context->getDrawFramebuffer();
- framebufferHandle = context->getDrawFramebufferHandle();
- }
</del><span class="cx">
</span><del>- if (!framebuffer || (framebufferHandle == 0 && renderbuffer != 0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><ins>+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
+ ASSERT(framebuffer);
</ins><span class="cx">
</span><span class="cx"> if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
</span><span class="cx"> {
</span><del>- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-
- if (colorAttachment >= context->getMaximumRenderTargets())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer);
</del><ins>+ unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> switch (attachment)
</span><span class="cx"> {
</span><span class="cx"> case GL_DEPTH_ATTACHMENT:
</span><del>- framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer);
</del><ins>+ framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
</ins><span class="cx"> break;
</span><span class="cx"> case GL_STENCIL_ATTACHMENT:
</span><del>- framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer);
</del><ins>+ framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
</ins><span class="cx"> break;
</span><ins>+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ framebuffer->setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
+ break;
</ins><span class="cx"> default:
</span><del>- return gl::error(GL_INVALID_ENUM);
</del><ins>+ UNREACHABLE();
+ break;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2438,129 +1967,40 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><del>-
</del><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2FramebufferTextureParameters(context, target, attachment, textarget, texture, level))
</ins><span class="cx"> {
</span><del>- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
</del><ins>+ return;
+ }
</ins><span class="cx">
</span><del>- if (colorAttachment >= context->getMaximumRenderTargets())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
- else
</del><ins>+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3FramebufferTextureParameters(context, target, attachment, textarget, texture, level, 0, false))
</ins><span class="cx"> {
</span><del>- switch (attachment)
- {
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (texture == 0)
</span><span class="cx"> {
</span><span class="cx"> textarget = GL_NONE;
</span><span class="cx"> }
</span><del>- else
- {
- gl::Texture *tex = context->getTexture(texture);
</del><span class="cx">
</span><del>- if (tex == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><ins>+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
</ins><span class="cx">
</span><del>- switch (textarget)
- {
- case GL_TEXTURE_2D:
- {
- if (tex->getTarget() != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- gl::Texture2D *tex2d = static_cast<gl::Texture2D *>(tex);
- if (tex2d->isCompressed(0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- }
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- gl::TextureCubeMap *texcube = static_cast<gl::TextureCubeMap *>(tex);
- if (texcube->isCompressed(textarget, level))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- }
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (level != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- gl::Framebuffer *framebuffer = NULL;
- GLuint framebufferHandle = 0;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
- {
- framebuffer = context->getReadFramebuffer();
- framebufferHandle = context->getReadFramebufferHandle();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- framebufferHandle = context->getDrawFramebufferHandle();
- }
-
- if (framebufferHandle == 0 || !framebuffer)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
</del><span class="cx"> if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
</span><span class="cx"> {
</span><span class="cx"> const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
</span><del>-
- if (colorAttachment >= context->getMaximumRenderTargets())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- framebuffer->setColorbuffer(colorAttachment, textarget, texture);
</del><ins>+ framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, 0);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> switch (attachment)
</span><span class="cx"> {
</span><del>- case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture); break;
- case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture); break;
</del><ins>+ case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, 0); break;
+ case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, 0); break;
+ case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, 0); break;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2637,41 +2077,52 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- switch (target)
</del><ins>+ if (!ValidTextureTarget(context, target))
</ins><span class="cx"> {
</span><del>- case GL_TEXTURE_2D:
- {
- gl::Texture2D *tex2d = context->getTexture2D();
</del><ins>+ return gl::error(GL_INVALID_ENUM);
+ }
</ins><span class="cx">
</span><del>- if (tex2d->isCompressed(0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- if (tex2d->isDepth(0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><ins>+ gl::Texture *texture = context->getTargetTexture(target);
</ins><span class="cx">
</span><del>- tex2d->generateMipmaps();
- break;
- }
</del><ins>+ if (texture == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
</ins><span class="cx">
</span><del>- case GL_TEXTURE_CUBE_MAP:
- {
- gl::TextureCubeMap *texcube = context->getTextureCubeMap();
</del><ins>+ GLenum internalFormat = texture->getBaseLevelInternalFormat();
</ins><span class="cx">
</span><del>- if (texcube->isCompressed(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><ins>+ // Internally, all texture formats are sized so checking if the format
+ // is color renderable and filterable will not fail.
</ins><span class="cx">
</span><del>- texcube->generateMipmaps();
- break;
</del><ins>+ bool validRenderable = (gl::IsColorRenderingSupported(internalFormat, context) ||
+ gl::IsSizedInternalFormat(internalFormat, context->getClientVersion()));
+
+ if (gl::IsDepthRenderingSupported(internalFormat, context) ||
+ gl::IsFormatCompressed(internalFormat, context->getClientVersion()) ||
+ !gl::IsTextureFilteringSupported(internalFormat, context) ||
+ !validRenderable)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Non-power of 2 ES2 check
+ if (!context->supportsNonPower2Texture() && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight())))
+ {
+ ASSERT(context->getClientVersion() <= 2 && (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<gl::TextureCubeMap *>(texture);
+ if (!textureCube->isCubeComplete())
+ {
+ return gl::error(GL_INVALID_OPERATION);
</ins><span class="cx"> }
</span><ins>+ }
</ins><span class="cx">
</span><del>- default:
- return gl::error(GL_INVALID_ENUM);
- }
</del><ins>+ texture->generateMipmaps();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -2697,7 +2148,7 @@
</span><span class="cx"> {
</span><span class="cx"> for (int i = 0; i < n; i++)
</span><span class="cx"> {
</span><del>- fences[i] = context->createFence();
</del><ins>+ fences[i] = context->createFenceNV();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2740,17 +2191,17 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- for (int i = 0; i < n; i++)
</del><ins>+ if (n < 0)
</ins><span class="cx"> {
</span><ins>+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
+ {
</ins><span class="cx"> ids[i] = context->createQuery();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2790,7 +2241,7 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glGenTextures(GLsizei n, GLuint* textures)
</span><span class="cx"> {
</span><del>- EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures);
</del><ins>+ EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures);
</ins><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><span class="lines">@@ -2996,51 +2447,23 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (!(context->getBooleanv(pname, params)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
</del><ins>+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx">
</span><del>- if (numParams == 0)
- return; // it is known that the pname is valid, but there are no parameters to return
</del><ins>+ // pname is valid, but there are no parameters to return
+ if (numParams == 0)
+ return;
</ins><span class="cx">
</span><del>- if (nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = NULL;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(pname, floatParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (floatParams[i] == 0.0f)
- params[i] = GL_FALSE;
- else
- params[i] = GL_TRUE;
- }
-
- delete [] floatParams;
- }
- else if (nativeType == GL_INT)
- {
- GLint *intParams = NULL;
- intParams = new GLint[numParams];
-
- context->getIntegerv(pname, intParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (intParams[i] == 0)
- params[i] = GL_FALSE;
- else
- params[i] = GL_TRUE;
- }
-
- delete [] intParams;
- }
</del><ins>+ if (nativeType == GL_BOOL)
+ {
+ context->getBooleanv(pname, params);
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -3059,19 +2482,18 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Buffer *buffer;
</del><ins>+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
</ins><span class="cx">
</span><del>- switch (target)
</del><ins>+ if (!gl::ValidBufferParameter(context, pname))
</ins><span class="cx"> {
</span><del>- case GL_ARRAY_BUFFER:
- buffer = context->getArrayBuffer();
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- buffer = context->getElementArrayBuffer();
- break;
- default: return gl::error(GL_INVALID_ENUM);
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
</ins><span class="cx"> if (!buffer)
</span><span class="cx"> {
</span><span class="cx"> // A null buffer means that "0" is bound to the requested buffer target
</span><span class="lines">@@ -3081,12 +2503,24 @@
</span><span class="cx"> switch (pname)
</span><span class="cx"> {
</span><span class="cx"> case GL_BUFFER_USAGE:
</span><del>- *params = buffer->usage();
</del><ins>+ *params = static_cast<GLint>(buffer->usage());
</ins><span class="cx"> break;
</span><span class="cx"> case GL_BUFFER_SIZE:
</span><del>- *params = buffer->size();
</del><ins>+ *params = gl::clampCast<GLint>(buffer->size());
</ins><span class="cx"> break;
</span><del>- default: return gl::error(GL_INVALID_ENUM);
</del><ins>+ case GL_BUFFER_ACCESS_FLAGS:
+ *params = buffer->accessFlags();
+ break;
+ case GL_BUFFER_MAPPED:
+ *params = static_cast<GLint>(buffer->mapped());
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *params = gl::clampCast<GLint>(buffer->mapOffset());
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *params = gl::clampCast<GLint>(buffer->mapLength());
+ break;
+ default: UNREACHABLE(); break;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3121,14 +2555,28 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Fence *fenceObject = context->getFence(fence);
</del><ins>+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
</ins><span class="cx">
</span><span class="cx"> if (fenceObject == NULL)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- fenceObject->getFenceiv(pname, params);
</del><ins>+ if (fenceObject->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->getFencei(pname);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -3147,48 +2595,23 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (!(context->getFloatv(pname, params)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
</del><ins>+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx">
</span><del>- if (numParams == 0)
- return; // it is known that the pname is valid, but that there are no parameters to return.
</del><ins>+ // pname is valid, but that there are no parameters to return.
+ if (numParams == 0)
+ return;
</ins><span class="cx">
</span><del>- if (nativeType == GL_BOOL)
- {
- GLboolean *boolParams = NULL;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(pname, boolParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (boolParams[i] == GL_FALSE)
- params[i] = 0.0f;
- else
- params[i] = 1.0f;
- }
-
- delete [] boolParams;
- }
- else if (nativeType == GL_INT)
- {
- GLint *intParams = NULL;
- intParams = new GLint[numParams];
-
- context->getIntegerv(pname, intParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- params[i] = (GLfloat)intParams[i];
- }
-
- delete [] intParams;
- }
</del><ins>+ if (nativeType == GL_FLOAT)
+ {
+ context->getFloatv(pname, params);
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -3208,68 +2631,162 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER_ANGLE && target != GL_READ_FRAMEBUFFER_ANGLE)
</del><ins>+ if (!gl::ValidFramebufferTarget(target))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Framebuffer *framebuffer = NULL;
- if (target == GL_READ_FRAMEBUFFER_ANGLE)
</del><ins>+ switch (pname)
</ins><span class="cx"> {
</span><del>- if(context->getReadFramebufferHandle() == 0)
</del><ins>+ 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->getClientVersion() >= 3)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ break;
</ins><span class="cx"> }
</span><ins>+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
</ins><span class="cx">
</span><del>- framebuffer = context->getReadFramebuffer();
- }
- else
</del><ins>+ // Determine if the attachment is a valid enum
+ switch (attachment)
</ins><span class="cx"> {
</span><del>- if (context->getDrawFramebufferHandle() == 0)
</del><ins>+ case GL_BACK:
+ case GL_FRONT:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (context->getClientVersion() < 3)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><ins>+ break;
</ins><span class="cx">
</span><del>- framebuffer = context->getDrawFramebuffer();
</del><ins>+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+
+ default:
+ if (attachment < GL_COLOR_ATTACHMENT0_EXT ||
+ (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getMaximumRenderTargets())
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ GLuint framebufferHandle = context->getTargetFramebufferHandle(target);
+ ASSERT(framebufferHandle != GL_INVALID_INDEX);
+ gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle);
+
</ins><span class="cx"> GLenum attachmentType;
</span><span class="cx"> GLuint attachmentHandle;
</span><ins>+ GLuint attachmentLevel;
+ GLuint attachmentLayer;
+ gl::Renderbuffer *renderbuffer;
</ins><span class="cx">
</span><del>- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
</del><ins>+ if(framebufferHandle == 0)
</ins><span class="cx"> {
</span><del>- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-
- if (colorAttachment >= context->getMaximumRenderTargets())
</del><ins>+ if(context->getClientVersion() < 3)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_ENUM);
</del><ins>+ return gl::error(GL_INVALID_OPERATION);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- attachmentType = framebuffer->getColorbufferType(colorAttachment);
- attachmentHandle = framebuffer->getColorbufferHandle(colorAttachment);
- }
- else
- {
</del><span class="cx"> switch (attachment)
</span><span class="cx"> {
</span><del>- case GL_DEPTH_ATTACHMENT:
</del><ins>+ case GL_BACK:
+ attachmentType = framebuffer->getColorbufferType(0);
+ attachmentHandle = framebuffer->getColorbufferHandle(0);
+ attachmentLevel = framebuffer->getColorbufferMipLevel(0);
+ attachmentLayer = framebuffer->getColorbufferLayer(0);
+ renderbuffer = framebuffer->getColorbuffer(0);
+ break;
+ case GL_DEPTH:
</ins><span class="cx"> attachmentType = framebuffer->getDepthbufferType();
</span><span class="cx"> attachmentHandle = framebuffer->getDepthbufferHandle();
</span><ins>+ attachmentLevel = framebuffer->getDepthbufferMipLevel();
+ attachmentLayer = framebuffer->getDepthbufferLayer();
+ renderbuffer = framebuffer->getDepthbuffer();
</ins><span class="cx"> break;
</span><del>- case GL_STENCIL_ATTACHMENT:
</del><ins>+ case GL_STENCIL:
</ins><span class="cx"> attachmentType = framebuffer->getStencilbufferType();
</span><span class="cx"> attachmentHandle = framebuffer->getStencilbufferHandle();
</span><ins>+ attachmentLevel = framebuffer->getStencilbufferMipLevel();
+ attachmentLayer = framebuffer->getStencilbufferLayer();
+ renderbuffer = framebuffer->getStencilbuffer();
</ins><span class="cx"> break;
</span><del>- default: return gl::error(GL_INVALID_ENUM);
</del><ins>+ default:
+ return gl::error(GL_INVALID_OPERATION);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ else
+ {
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ attachmentType = framebuffer->getColorbufferType(colorAttachment);
+ attachmentHandle = framebuffer->getColorbufferHandle(colorAttachment);
+ attachmentLevel = framebuffer->getColorbufferMipLevel(colorAttachment);
+ attachmentLayer = framebuffer->getColorbufferLayer(colorAttachment);
+ renderbuffer = framebuffer->getColorbuffer(colorAttachment);
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ attachmentType = framebuffer->getDepthbufferType();
+ attachmentHandle = framebuffer->getDepthbufferHandle();
+ attachmentLevel = framebuffer->getDepthbufferMipLevel();
+ attachmentLayer = framebuffer->getDepthbufferLayer();
+ renderbuffer = framebuffer->getDepthbuffer();
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ attachmentType = framebuffer->getStencilbufferType();
+ attachmentHandle = framebuffer->getStencilbufferHandle();
+ attachmentLevel = framebuffer->getStencilbufferMipLevel();
+ attachmentLayer = framebuffer->getStencilbufferLayer();
+ renderbuffer = framebuffer->getStencilbuffer();
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (framebuffer->getDepthbufferHandle() != framebuffer->getStencilbufferHandle())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ attachmentType = framebuffer->getDepthStencilbufferType();
+ attachmentHandle = framebuffer->getDepthStencilbufferHandle();
+ attachmentLevel = framebuffer->getDepthStencilbufferMipLevel();
+ attachmentLayer = framebuffer->getDepthStencilbufferLayer();
+ renderbuffer = framebuffer->getDepthStencilBuffer();
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
</ins><span class="cx">
</span><span class="cx"> GLenum attachmentObjectType; // Type category
</span><del>- if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
</del><ins>+ if (framebufferHandle == 0)
</ins><span class="cx"> {
</span><ins>+ attachmentObjectType = GL_FRAMEBUFFER_DEFAULT;
+ }
+ else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
+ {
</ins><span class="cx"> attachmentObjectType = attachmentType;
</span><span class="cx"> }
</span><del>- else if (gl::IsInternalTextureTarget(attachmentType))
</del><ins>+ else if (gl::IsInternalTextureTarget(attachmentType, context->getClientVersion()))
</ins><span class="cx"> {
</span><span class="cx"> attachmentObjectType = GL_TEXTURE;
</span><span class="cx"> }
</span><span class="lines">@@ -3279,50 +2796,124 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- switch (pname)
</del><ins>+ if (attachmentObjectType == GL_NONE)
</ins><span class="cx"> {
</span><del>- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
- *params = attachmentObjectType;
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
- if (attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE)
</del><ins>+ // 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)
</ins><span class="cx"> {
</span><del>- *params = attachmentHandle;
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
- if (attachmentObjectType == GL_TEXTURE)
- {
- *params = 0; // FramebufferTexture2D will not allow level to be set to anything else in GL ES 2.0
- }
- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
- if (attachmentObjectType == GL_TEXTURE)
- {
- if (gl::IsCubemapTextureTarget(attachmentType))
</del><ins>+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObjectType;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (context->getClientVersion() < 3)
</ins><span class="cx"> {
</span><del>- *params = attachmentType;
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><ins>+ *params = 0;
+ break;
+
+ default:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
</ins><span class="cx"> else
</span><span class="cx"> {
</span><del>- *params = 0;
</del><ins>+ gl::error(GL_INVALID_OPERATION);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else
</del><ins>+ }
+ else
+ {
+ ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE ||
+ attachmentObjectType == GL_FRAMEBUFFER_DEFAULT);
+ ASSERT(renderbuffer != NULL);
+
+ switch (pname)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_ENUM);
</del><ins>+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObjectType;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (attachmentObjectType != GL_RENDERBUFFER && 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->getRedSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ *params = renderbuffer->getGreenSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ *params = renderbuffer->getBlueSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ *params = renderbuffer->getAlphaSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ *params = renderbuffer->getDepthSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ *params = renderbuffer->getStencilSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ if (attachment == GL_DEPTH_STENCIL)
+ {
+ gl::error(GL_INVALID_OPERATION);
+ }
+ *params = renderbuffer->getComponentType();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ *params = renderbuffer->getColorEncoding();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = attachmentLayer;
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
</ins><span class="cx"> }
</span><del>- break;
- default:
- return gl::error(GL_INVALID_ENUM);
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3363,53 +2954,23 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (!(context->getIntegerv(pname, params)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
</del><ins>+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getQueryParameterInfo(pname, &nativeType, &numParams))
+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx">
</span><del>- if (numParams == 0)
- return; // it is known that pname is valid, but there are no parameters to return
</del><ins>+ // pname is valid, but there are no parameters to return
+ if (numParams == 0)
+ return;
</ins><span class="cx">
</span><del>- if (nativeType == GL_BOOL)
- {
- GLboolean *boolParams = NULL;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(pname, boolParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (boolParams[i] == GL_FALSE)
- params[i] = 0;
- else
- params[i] = 1;
- }
-
- delete [] boolParams;
- }
- else if (nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = NULL;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(pname, floatParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
- {
- params[i] = (GLint)(((GLfloat)(0xFFFFFFFF) * floatParams[i] - 1.0f) / 2.0f);
- }
- else
- params[i] = (GLint)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
- }
-
- delete [] floatParams;
- }
</del><ins>+ if (nativeType == GL_INT)
+ {
+ context->getIntegerv(pname, params);
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -3435,6 +2996,19 @@
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (context->getClientVersion() < 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);
+ }
+ }
+
</ins><span class="cx"> switch (pname)
</span><span class="cx"> {
</span><span class="cx"> case GL_DELETE_STATUS:
</span><span class="lines">@@ -3467,6 +3041,21 @@
</span><span class="cx"> case GL_PROGRAM_BINARY_LENGTH_OES:
</span><span class="cx"> *params = programObject->getProgramBinaryLength();
</span><span class="cx"> return;
</span><ins>+ case GL_ACTIVE_UNIFORM_BLOCKS:
+ *params = programObject->getActiveUniformBlockCount();
+ return;
+ case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+ *params = programObject->getActiveUniformBlockMaxLength();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ *params = programObject->getTransformFeedbackBufferMode();
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ *params = programObject->getTransformFeedbackVaryingCount();
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ *params = programObject->getTransformFeedbackVaryingMaxLength();
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -3516,19 +3105,24 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- switch (pname)
- {
- case GL_CURRENT_QUERY_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- params[0] = context->getActiveQuery(target);
</del><ins>+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_CURRENT_QUERY_EXT:
+ params[0] = context->getActiveQuery(target);
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -3543,14 +3137,6 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- switch (pname)
- {
- case GL_QUERY_RESULT_EXT:
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="lines">@@ -3576,7 +3162,7 @@
</span><span class="cx"> params[0] = queryObject->isResultAvailable();
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><del>- ASSERT(false);
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3844,11 +3430,25 @@
</span><span class="cx"> case GL_RENDERER:
</span><span class="cx"> return (GLubyte*)((context != NULL) ? context->getRendererString() : "ANGLE");
</span><span class="cx"> case GL_VERSION:
</span><del>- return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")";
</del><ins>+ if (context->getClientVersion() == 2)
+ {
+ return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ else
+ {
+ return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
</ins><span class="cx"> case GL_SHADING_LANGUAGE_VERSION:
</span><del>- return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")";
</del><ins>+ if (context->getClientVersion() == 2)
+ {
+ return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ else
+ {
+ return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
</ins><span class="cx"> case GL_EXTENSIONS:
</span><del>- return (GLubyte*)((context != NULL) ? context->getExtensionString() : "");
</del><ins>+ return (GLubyte*)((context != NULL) ? context->getCombinedExtensionsString() : "");
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM, (GLubyte*)NULL);
</span><span class="cx"> }
</span><span class="lines">@@ -3869,17 +3469,10 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Texture *texture;
</del><ins>+ gl::Texture *texture = context->getTargetTexture(target);
</ins><span class="cx">
</span><del>- switch (target)
</del><ins>+ if (!texture)
</ins><span class="cx"> {
</span><del>- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3897,9 +3490,24 @@
</span><span class="cx"> case GL_TEXTURE_WRAP_T:
</span><span class="cx"> *params = (GLfloat)texture->getWrapT();
</span><span class="cx"> break;
</span><del>- case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
</del><ins>+ case GL_TEXTURE_WRAP_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getWrapR();
+ break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
</ins><span class="cx"> *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE);
</span><span class="cx"> break;
</span><ins>+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->immutableLevelCount();
+ break;
</ins><span class="cx"> case GL_TEXTURE_USAGE_ANGLE:
</span><span class="cx"> *params = (GLfloat)texture->getUsage();
</span><span class="cx"> break;
</span><span class="lines">@@ -3910,6 +3518,62 @@
</span><span class="cx"> }
</span><span class="cx"> *params = (GLfloat)texture->getMaxAnisotropy();
</span><span class="cx"> break;
</span><ins>+ case GL_TEXTURE_SWIZZLE_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleRed();
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleGreen();
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleBlue();
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSwizzleAlpha();
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getBaseLevel();
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getMaxLevel();
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getMinLod();
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getMaxLod();
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -3931,17 +3595,10 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Texture *texture;
</del><ins>+ gl::Texture *texture = context->getTargetTexture(target);
</ins><span class="cx">
</span><del>- switch (target)
</del><ins>+ if (!texture)
</ins><span class="cx"> {
</span><del>- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3959,9 +3616,24 @@
</span><span class="cx"> case GL_TEXTURE_WRAP_T:
</span><span class="cx"> *params = texture->getWrapT();
</span><span class="cx"> break;
</span><del>- case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
</del><ins>+ case GL_TEXTURE_WRAP_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getWrapR();
+ break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
</ins><span class="cx"> *params = texture->isImmutable() ? GL_TRUE : GL_FALSE;
</span><span class="cx"> break;
</span><ins>+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->immutableLevelCount();
+ break;
</ins><span class="cx"> case GL_TEXTURE_USAGE_ANGLE:
</span><span class="cx"> *params = texture->getUsage();
</span><span class="cx"> break;
</span><span class="lines">@@ -3972,6 +3644,62 @@
</span><span class="cx"> }
</span><span class="cx"> *params = (GLint)texture->getMaxAnisotropy();
</span><span class="cx"> break;
</span><ins>+ case GL_TEXTURE_SWIZZLE_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleRed();
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleGreen();
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleBlue();
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSwizzleAlpha();
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getBaseLevel();
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getMaxLevel();
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLint)texture->getMinLod();
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLint)texture->getMaxLod();
+ break;
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -4218,37 +3946,23 @@
</span><span class="cx">
</span><span class="cx"> const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
</span><span class="cx">
</span><del>- switch (pname)
</del><ins>+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
</ins><span class="cx"> {
</span><del>- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (GLfloat)(attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = (GLfloat)attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = (GLfloat)attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = (GLfloat)attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (GLfloat)(attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = (GLfloat)attribState.mBoundBuffer.id();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
</del><ins>+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
</ins><span class="cx"> for (int i = 0; i < 4; ++i)
</span><span class="cx"> {
</span><del>- params[i] = attribState.mCurrentValue[i];
</del><ins>+ params[i] = currentValueData.FloatValues[i];
</ins><span class="cx"> }
</span><del>- break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
- *params = (GLfloat)attribState.mDivisor;
- break;
- default: return gl::error(GL_INVALID_ENUM);
</del><span class="cx"> }
</span><ins>+ else
+ {
+ *params = attribState.querySingleParameter<GLfloat>(pname);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -4274,38 +3988,24 @@
</span><span class="cx">
</span><span class="cx"> const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
</span><span class="cx">
</span><del>- switch (pname)
</del><ins>+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
</ins><span class="cx"> {
</span><del>- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = attribState.mBoundBuffer.id();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
</del><ins>+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
</ins><span class="cx"> for (int i = 0; i < 4; ++i)
</span><span class="cx"> {
</span><del>- float currentValue = attribState.mCurrentValue[i];
- params[i] = (GLint)(currentValue > 0.0f ? floor(currentValue + 0.5f) : ceil(currentValue - 0.5f));
</del><ins>+ float currentValue = currentValueData.FloatValues[i];
+ params[i] = gl::iround<GLint>(currentValue);
</ins><span class="cx"> }
</span><del>- break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
- *params = (GLint)attribState.mDivisor;
- break;
- default: return gl::error(GL_INVALID_ENUM);
</del><span class="cx"> }
</span><ins>+ else
+ {
+ *params = attribState.querySingleParameter<GLint>(pname);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -4414,20 +4114,12 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- switch (cap)
</del><ins>+ if (!ValidCap(context, cap))
</ins><span class="cx"> {
</span><del>- case GL_CULL_FACE: return context->isCullFaceEnabled();
- case GL_POLYGON_OFFSET_FILL: return context->isPolygonOffsetFillEnabled();
- case GL_SAMPLE_ALPHA_TO_COVERAGE: return context->isSampleAlphaToCoverageEnabled();
- case GL_SAMPLE_COVERAGE: return context->isSampleCoverageEnabled();
- case GL_SCISSOR_TEST: return context->isScissorTestEnabled();
- case GL_STENCIL_TEST: return context->isStencilTestEnabled();
- case GL_DEPTH_TEST: return context->isDepthTestEnabled();
- case GL_BLEND: return context->isBlendEnabled();
- case GL_DITHER: return context->isDitherEnabled();
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM, false);
</span><span class="cx"> }
</span><ins>+
+ return context->getCap(cap);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -4448,7 +4140,7 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Fence *fenceObject = context->getFence(fence);
</del><ins>+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
</ins><span class="cx">
</span><span class="cx"> if (fenceObject == NULL)
</span><span class="cx"> {
</span><span class="lines">@@ -4524,21 +4216,11 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (id == 0)
- {
- return GL_FALSE;
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
-
- if (queryObject)
- {
- return GL_TRUE;
- }
</del><ins>+ return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -4718,6 +4400,21 @@
</span><span class="cx"> context->setPackReverseRowOrder(param != 0);
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ 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->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ UNIMPLEMENTED();
+ break;
+
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -4767,17 +4464,10 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- GLenum currentFormat, currentType;
-
- // 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.
- if (!context->getCurrentReadFormatType(&currentFormat, &currentType))
</del><ins>+ if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
+ format, type, &bufSize, data))
+ {
</ins><span class="cx"> return;
</span><del>-
- if (!(currentFormat == format && currentType == type) && !validReadFormatType(format, type))
- {
- return gl::error(GL_INVALID_OPERATION);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> context->readPixels(x, y, width, height, format, type, &bufSize, data);
</span><span class="lines">@@ -4807,17 +4497,10 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- GLenum currentFormat, currentType;
-
- // 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.
- if (!context->getCurrentReadFormatType(&currentFormat, &currentType))
</del><ins>+ if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
+ format, type, NULL, pixels))
+ {
</ins><span class="cx"> return;
</span><del>-
- if (!(currentFormat == format && currentType == type) && !validReadFormatType(format, type))
- {
- return gl::error(GL_INVALID_OPERATION);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> context->readPixels(x, y, width, height, format, type, NULL, pixels);
</span><span class="lines">@@ -4850,56 +4533,17 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- switch (target)
- {
- case GL_RENDERBUFFER:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (!gl::IsColorRenderable(internalformat) && !gl::IsDepthRenderable(internalformat) && !gl::IsStencilRenderable(internalformat))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (width < 0 || height < 0 || samples < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (width > context->getMaximumRenderbufferDimension() ||
- height > context->getMaximumRenderbufferDimension() ||
- samples > context->getMaxSupportedSamples())
</del><ins>+ if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
+ width, height, true))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- GLuint handle = context->getRenderbufferHandle();
- if (handle == 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (internalformat)
- {
- case GL_DEPTH_COMPONENT16:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- context->setRenderbufferStorage(width, height, internalformat, samples);
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
</del><ins>+ context->setRenderbufferStorage(width, height, internalformat, samples);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -4915,7 +4559,7 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glSampleCoverage(GLclampf value, GLboolean invert)
</span><span class="cx"> {
</span><del>- EVENT("(GLclampf value = %f, GLboolean invert = %d)", value, invert);
</del><ins>+ EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert);
</ins><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><span class="lines">@@ -4947,7 +4591,7 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Fence *fenceObject = context->getFence(fence);
</del><ins>+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
</ins><span class="cx">
</span><span class="cx"> if (fenceObject == NULL)
</span><span class="cx"> {
</span><span class="lines">@@ -5004,7 +4648,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
</del><ins>+void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length)
</ins><span class="cx"> {
</span><span class="cx"> EVENT("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)",
</span><span class="cx"> shader, count, string, length);
</span><span class="lines">@@ -5240,13 +4884,18 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Fence *fenceObject = context->getFence(fence);
</del><ins>+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
</ins><span class="cx">
</span><span class="cx"> if (fenceObject == NULL)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION, GL_TRUE);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_TRUE);
+ }
+
</ins><span class="cx"> return fenceObject->testFence();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -5262,283 +4911,75 @@
</span><span class="cx"> GLint border, GLenum format, GLenum type, const GLvoid* pixels)
</span><span class="cx"> {
</span><span class="cx"> EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, "
</span><del>- "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
</del><ins>+ "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
</ins><span class="cx"> target, level, internalformat, width, height, border, format, type, pixels);
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (!validImageSize(level, width, height))
- {
- return gl::error(GL_INVALID_VALUE);
- }
</del><ins>+ gl::Context *context = gl::getNonLostContext();
</ins><span class="cx">
</span><del>- if (internalformat != GLint(format))
</del><ins>+ if (context)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
- }
-
- // validate <type> by itself (used as secondary key below)
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- case GL_UNSIGNED_INT_24_8_OES:
- case GL_HALF_FLOAT_OES:
- case GL_FLOAT:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- // validate <format> + <type> combinations
- // - invalid <format> -> sets INVALID_ENUM
- // - invalid <format>+<type> combination -> sets INVALID_OPERATION
- switch (format)
- {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- switch (type)
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, width, height, border, format, type, pixels))
</ins><span class="cx"> {
</span><del>- case GL_UNSIGNED_BYTE:
- case GL_FLOAT:
- case GL_HALF_FLOAT_OES:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ return;
</ins><span class="cx"> }
</span><del>- 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);
- }
- 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);
- }
- break;
- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // error cases for compressed textures are handled below
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- break;
- case GL_DEPTH_COMPONENT:
- switch (type)
- {
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- case GL_DEPTH_STENCIL_OES:
- switch (type)
- {
- case GL_UNSIGNED_INT_24_8_OES:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
</del><span class="cx">
</span><del>- if (border != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (level > context->getMaximumTextureLevel())
</del><ins>+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, 0, width, height, 1, border, format, type, pixels))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> switch (target)
</span><span class="cx"> {
</span><span class="cx"> case GL_TEXTURE_2D:
</span><del>- if (width > (context->getMaximumTextureDimension() >> level) ||
- height > (context->getMaximumTextureDimension() >> level))
</del><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::Texture2D *texture = context->getTexture2D();
+ texture->setImage(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
</span><del>- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if (width != height)
</del><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosX(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><del>-
- if (width > (context->getMaximumCubeTextureDimension() >> level) ||
- height > (context->getMaximumCubeTextureDimension() >> level))
</del><ins>+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegX(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (format) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (context->supportsDXT1Textures())
</del><ins>+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosY(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><del>- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
</del><span class="cx"> break;
</span><del>- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (context->supportsDXT3Textures())
</del><ins>+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegY(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><del>- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
</del><span class="cx"> break;
</span><del>- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (context->supportsDXT5Textures())
</del><ins>+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_OPERATION);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosZ(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><del>- else
- {
- return gl::error(GL_INVALID_ENUM);
- }
</del><span class="cx"> break;
</span><del>- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- if (!context->supportsDepthTextures())
</del><ins>+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegZ(level, width, height, internalformat, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><del>- if (target != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- // OES_depth_texture supports loading depth data and multiple levels,
- // but ANGLE_depth_texture does not
- if (pixels != NULL || level != 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><span class="cx"> break;
</span><del>- default:
- break;
</del><ins>+ default: UNREACHABLE();
</ins><span class="cx"> }
</span><del>-
- if (type == GL_FLOAT)
- {
- if (!context->supportsFloat32Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- }
- else if (type == GL_HALF_FLOAT_OES)
- {
- if (!context->supportsFloat16Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- }
-
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->setImage(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- }
- else
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if (!texture)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (target)
- {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- texture->setImagePosX(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- texture->setImageNegX(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- texture->setImagePosY(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- texture->setImageNegY(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- texture->setImagePosZ(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- texture->setImageNegZ(level, width, height, format, type, context->getUnpackAlignment(), pixels);
- break;
- default: UNREACHABLE();
- }
- }
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -5557,64 +4998,38 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Texture *texture;
</del><ins>+ if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
+ {
+ return;
+ }
</ins><span class="cx">
</span><del>- switch (target)
</del><ins>+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
</ins><span class="cx"> {
</span><del>- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> switch (pname)
</span><span class="cx"> {
</span><del>- case GL_TEXTURE_WRAP_S:
- if (!texture->setWrapS((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if (!texture->setWrapT((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MIN_FILTER:
- if (!texture->setMinFilter((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- if (!texture->setMagFilter((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_USAGE_ANGLE:
- if (!texture->setUsage((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->supportsTextureFilterAnisotropy())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- if (!texture->setMaxAnisotropy((float)param, context->getTextureMaxAnisotropy()))
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
</del><ins>+ case GL_TEXTURE_WRAP_S: texture->setWrapS(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_T: texture->setWrapT(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_WRAP_R: texture->setWrapR(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MIN_FILTER: texture->setMinFilter(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MAG_FILTER: texture->setMagFilter(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->setMaxAnisotropy(param, context->getTextureMaxAnisotropy()); break;
+ case GL_TEXTURE_COMPARE_MODE: texture->setCompareMode(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_COMPARE_FUNC: texture->setCompareFunc(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_R: texture->setSwizzleRed(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_G: texture->setSwizzleGreen(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_B: texture->setSwizzleBlue(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_SWIZZLE_A: texture->setSwizzleAlpha(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_BASE_LEVEL: texture->setBaseLevel(gl::iround<GLint>(param)); break;
+ case GL_TEXTURE_MAX_LEVEL: texture->setMaxLevel(gl::iround<GLint>(param)); break;
+ case GL_TEXTURE_MIN_LOD: texture->setMinLod(param); break;
+ case GL_TEXTURE_MAX_LOD: texture->setMaxLod(param); break;
+ default: UNREACHABLE(); break;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -5639,64 +5054,38 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- gl::Texture *texture;
</del><ins>+ if (!ValidateTexParamParameters(context, pname, param))
+ {
+ return;
+ }
</ins><span class="cx">
</span><del>- switch (target)
</del><ins>+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
</ins><span class="cx"> {
</span><del>- case GL_TEXTURE_2D:
- texture = context->getTexture2D();
- break;
- case GL_TEXTURE_CUBE_MAP:
- texture = context->getTextureCubeMap();
- break;
- default:
</del><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> switch (pname)
</span><span class="cx"> {
</span><del>- case GL_TEXTURE_WRAP_S:
- if (!texture->setWrapS((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if (!texture->setWrapT((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MIN_FILTER:
- if (!texture->setMinFilter((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- if (!texture->setMagFilter((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_USAGE_ANGLE:
- if (!texture->setUsage((GLenum)param))
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->supportsTextureFilterAnisotropy())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- if (!texture->setMaxAnisotropy((float)param, context->getTextureMaxAnisotropy()))
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
</del><ins>+ case GL_TEXTURE_WRAP_S: texture->setWrapS((GLenum)param); break;
+ case GL_TEXTURE_WRAP_T: texture->setWrapT((GLenum)param); break;
+ case GL_TEXTURE_WRAP_R: texture->setWrapR((GLenum)param); break;
+ case GL_TEXTURE_MIN_FILTER: texture->setMinFilter((GLenum)param); break;
+ case GL_TEXTURE_MAG_FILTER: texture->setMagFilter((GLenum)param); break;
+ case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->setMaxAnisotropy((float)param, context->getTextureMaxAnisotropy()); break;
+ case GL_TEXTURE_COMPARE_MODE: texture->setCompareMode((GLenum)param); break;
+ case GL_TEXTURE_COMPARE_FUNC: texture->setCompareFunc((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_R: texture->setSwizzleRed((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_G: texture->setSwizzleGreen((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_B: texture->setSwizzleBlue((GLenum)param); break;
+ case GL_TEXTURE_SWIZZLE_A: texture->setSwizzleAlpha((GLenum)param); break;
+ case GL_TEXTURE_BASE_LEVEL: texture->setBaseLevel(param); break;
+ case GL_TEXTURE_MAX_LEVEL: texture->setMaxLevel(param); break;
+ case GL_TEXTURE_MIN_LOD: texture->setMinLod((GLfloat)param); break;
+ case GL_TEXTURE_MAX_LOD: texture->setMaxLod((GLfloat)param); break;
+ default: UNREACHABLE(); break;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -5718,161 +5107,41 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (width < 1 || height < 1 || levels < 1)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (target == GL_TEXTURE_CUBE_MAP && width != height)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- GLenum format = gl::ExtractFormat(internalformat);
- GLenum type = gl::ExtractType(internalformat);
-
- if (format == GL_NONE || type == GL_NONE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- switch (target)
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height))
</ins><span class="cx"> {
</span><del>- case GL_TEXTURE_2D:
- if (width > context->getMaximumTextureDimension() ||
- height > context->getMaximumTextureDimension())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_CUBE_MAP:
- if (width > context->getMaximumCubeTextureDimension() ||
- height > context->getMaximumCubeTextureDimension())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (levels != 1 && !context->supportsNonPower2Texture())
</del><ins>+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
</ins><span class="cx"> {
</span><del>- if (!gl::isPow2(width) || !gl::isPow2(height))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- switch (internalformat)
</del><ins>+ switch (target)
</ins><span class="cx"> {
</span><del>- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- if (!context->supportsDXT1Textures())
</del><ins>+ case GL_TEXTURE_2D:
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_ENUM);
</del><ins>+ gl::Texture2D *texture2d = context->getTexture2D();
+ texture2d->storage(levels, internalformat, width, height);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- if (!context->supportsDXT3Textures())
</del><ins>+
+ case GL_TEXTURE_CUBE_MAP:
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_ENUM);
</del><ins>+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ textureCube->storage(levels, internalformat, width);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- if (!context->supportsDXT5Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_RGBA32F_EXT:
- case GL_RGB32F_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- if (!context->supportsFloat32Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_RGBA16F_EXT:
- case GL_RGB16F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- if (!context->supportsFloat16Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH24_STENCIL8_OES:
- if (!context->supportsDepthTextures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- if (target != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- // ANGLE_depth_texture only supports 1-level textures
- if (levels != 1)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
</del><ins>+
</ins><span class="cx"> default:
</span><del>- break;
</del><ins>+ return gl::error(GL_INVALID_ENUM);
</ins><span class="cx"> }
</span><del>-
- if (target == GL_TEXTURE_2D)
- {
- gl::Texture2D *texture = context->getTexture2D();
-
- if (!texture || texture->id() == 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->storage(levels, internalformat, width, height);
- }
- else if (target == GL_TEXTURE_CUBE_MAP)
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if (!texture || texture->id() == 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (texture->isImmutable())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- texture->storage(levels, internalformat, width);
- }
- else UNREACHABLE();
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -5891,86 +5160,52 @@
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (!gl::IsInternalTextureTarget(target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (level < 0 || xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (!checkTextureFormatType(format, type))
- {
- return; // error is set by helper function
- }
-
</del><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (level > context->getMaximumTextureLevel())
</del><ins>+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, width, height, 0, format, type, pixels))
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE);
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (format == GL_FLOAT)
</del><ins>+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels))
</ins><span class="cx"> {
</span><del>- if (!context->supportsFloat32Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
</del><ins>+ return;
</ins><span class="cx"> }
</span><del>- else if (format == GL_HALF_FLOAT_OES)
- {
- if (!context->supportsFloat16Textures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- }
- else if (gl::IsDepthTexture(format))
- {
- if (!context->supportsDepthTextures())
- {
- return gl::error(GL_INVALID_ENUM);
- }
- if (target != GL_TEXTURE_2D)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- // OES_depth_texture supports loading depth data, but ANGLE_depth_texture does not
- return gl::error(GL_INVALID_OPERATION);
- }
</del><span class="cx">
</span><del>- if (width == 0 || height == 0 || pixels == NULL)
</del><ins>+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0)
</ins><span class="cx"> {
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (target == GL_TEXTURE_2D)
</del><ins>+ switch (target)
</ins><span class="cx"> {
</span><del>- gl::Texture2D *texture = context->getTexture2D();
- if (validateSubImageParams2D(false, width, height, xoffset, yoffset, level, format, type, texture))
</del><ins>+ case GL_TEXTURE_2D:
</ins><span class="cx"> {
</span><del>- texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
</del><ins>+ gl::Texture2D *texture = context->getTexture2D();
+ texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><del>- }
- else if (gl::IsCubemapTextureTarget(target))
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- if (validateSubImageParamsCube(false, width, height, xoffset, yoffset, target, level, format, type, texture))
</del><ins>+ 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:
</ins><span class="cx"> {
</span><del>- texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
</del><ins>+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getUnpackState(), pixels);
</ins><span class="cx"> }
</span><del>- }
- else
- {
</del><ins>+ break;
+
+ default:
</ins><span class="cx"> UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -6071,7 +5306,7 @@
</span><span class="cx"> {
</span><span class="cx"> GLfloat xy[2] = {x, y};
</span><span class="cx">
</span><del>- glUniform2fv(location, 1, (GLfloat*)&xy);
</del><ins>+ glUniform2fv(location, 1, xy);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
</span><span class="lines">@@ -6114,9 +5349,9 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniform2i(GLint location, GLint x, GLint y)
</span><span class="cx"> {
</span><del>- GLint xy[4] = {x, y};
</del><ins>+ GLint xy[2] = {x, y};
</ins><span class="cx">
</span><del>- glUniform2iv(location, 1, (GLint*)&xy);
</del><ins>+ glUniform2iv(location, 1, xy);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v)
</span><span class="lines">@@ -6161,7 +5396,7 @@
</span><span class="cx"> {
</span><span class="cx"> GLfloat xyz[3] = {x, y, z};
</span><span class="cx">
</span><del>- glUniform3fv(location, 1, (GLfloat*)&xyz);
</del><ins>+ glUniform3fv(location, 1, xyz);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
</span><span class="lines">@@ -6206,7 +5441,7 @@
</span><span class="cx"> {
</span><span class="cx"> GLint xyz[3] = {x, y, z};
</span><span class="cx">
</span><del>- glUniform3iv(location, 1, (GLint*)&xyz);
</del><ins>+ glUniform3iv(location, 1, xyz);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v)
</span><span class="lines">@@ -6251,7 +5486,7 @@
</span><span class="cx"> {
</span><span class="cx"> GLfloat xyzw[4] = {x, y, z, w};
</span><span class="cx">
</span><del>- glUniform4fv(location, 1, (GLfloat*)&xyzw);
</del><ins>+ glUniform4fv(location, 1, xyzw);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
</span><span class="lines">@@ -6296,7 +5531,7 @@
</span><span class="cx"> {
</span><span class="cx"> GLint xyzw[4] = {x, y, z, w};
</span><span class="cx">
</span><del>- glUniform4iv(location, 1, (GLint*)&xyzw);
</del><ins>+ glUniform4iv(location, 1, xyzw);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v)
</span><span class="lines">@@ -6339,12 +5574,12 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</span><span class="cx"> {
</span><del>- EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
</del><ins>+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
</ins><span class="cx"> location, count, transpose, value);
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (count < 0 || transpose != GL_FALSE)
</del><ins>+ if (count < 0)
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="lines">@@ -6358,13 +5593,18 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ if (transpose != GL_FALSE && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
</ins><span class="cx"> gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
</span><span class="cx"> if (!programBinary)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!programBinary->setUniformMatrix2fv(location, count, value))
</del><ins>+ if (!programBinary->setUniformMatrix2fv(location, count, transpose, value))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="lines">@@ -6378,12 +5618,12 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</span><span class="cx"> {
</span><del>- EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
</del><ins>+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
</ins><span class="cx"> location, count, transpose, value);
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (count < 0 || transpose != GL_FALSE)
</del><ins>+ if (count < 0)
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="lines">@@ -6397,13 +5637,18 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ if (transpose != GL_FALSE && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
</ins><span class="cx"> gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
</span><span class="cx"> if (!programBinary)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!programBinary->setUniformMatrix3fv(location, count, value))
</del><ins>+ if (!programBinary->setUniformMatrix3fv(location, count, transpose, value))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="lines">@@ -6417,12 +5662,12 @@
</span><span class="cx">
</span><span class="cx"> void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</span><span class="cx"> {
</span><del>- EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = 0x%0.8p)",
</del><ins>+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
</ins><span class="cx"> location, count, transpose, value);
</span><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- if (count < 0 || transpose != GL_FALSE)
</del><ins>+ if (count < 0)
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="lines">@@ -6436,13 +5681,18 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><ins>+ if (transpose != GL_FALSE && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
</ins><span class="cx"> gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
</span><span class="cx"> if (!programBinary)
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!programBinary->setUniformMatrix4fv(location, count, value))
</del><ins>+ if (!programBinary->setUniformMatrix4fv(location, count, transpose, value))
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="lines">@@ -6541,7 +5791,7 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> GLfloat vals[4] = { x, 0, 0, 1 };
</span><del>- context->setVertexAttrib(index, vals);
</del><ins>+ context->setVertexAttribf(index, vals);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6566,7 +5816,7 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> GLfloat vals[4] = { values[0], 0, 0, 1 };
</span><del>- context->setVertexAttrib(index, vals);
</del><ins>+ context->setVertexAttribf(index, vals);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6591,7 +5841,7 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> GLfloat vals[4] = { x, y, 0, 1 };
</span><del>- context->setVertexAttrib(index, vals);
</del><ins>+ context->setVertexAttribf(index, vals);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6616,7 +5866,7 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> GLfloat vals[4] = { values[0], values[1], 0, 1 };
</span><del>- context->setVertexAttrib(index, vals);
</del><ins>+ context->setVertexAttribf(index, vals);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6641,7 +5891,7 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> GLfloat vals[4] = { x, y, z, 1 };
</span><del>- context->setVertexAttrib(index, vals);
</del><ins>+ context->setVertexAttribf(index, vals);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6666,7 +5916,7 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> GLfloat vals[4] = { values[0], values[1], values[2], 1 };
</span><del>- context->setVertexAttrib(index, vals);
</del><ins>+ context->setVertexAttribf(index, vals);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6691,7 +5941,7 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> GLfloat vals[4] = { x, y, z, w };
</span><del>- context->setVertexAttrib(index, vals);
</del><ins>+ context->setVertexAttribf(index, vals);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6715,7 +5965,7 @@
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- context->setVertexAttrib(index, values);
</del><ins>+ context->setVertexAttribf(index, values);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6751,7 +6001,7 @@
</span><span class="cx"> void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
</span><span class="cx"> {
</span><span class="cx"> EVENT("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, "
</span><del>- "GLboolean normalized = %d, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
</del><ins>+ "GLboolean normalized = %u, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
</ins><span class="cx"> index, size, type, normalized, stride, ptr);
</span><span class="cx">
</span><span class="cx"> try
</span><span class="lines">@@ -6766,6 +6016,8 @@
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::Context *context = gl::getNonLostContext();
+
</ins><span class="cx"> switch (type)
</span><span class="cx"> {
</span><span class="cx"> case GL_BYTE:
</span><span class="lines">@@ -6775,6 +6027,19 @@
</span><span class="cx"> case GL_FIXED:
</span><span class="cx"> case GL_FLOAT:
</span><span class="cx"> break;
</span><ins>+ 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 && context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ else
+ {
+ break;
+ }
</ins><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="lines">@@ -6784,11 +6049,24 @@
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Context *context = gl::getNonLostContext();
</del><ins>+ if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
</ins><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- context->setVertexAttribState(index, context->getArrayBuffer(), size, type, (normalized == GL_TRUE), stride, ptr);
</del><ins>+ // [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->getVertexArrayHandle() != 0 && context->getArrayBufferHandle() == 0 && ptr != NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->setVertexAttribState(index, context->getArrayBuffer(), size, type,
+ normalized == GL_TRUE, false, stride, ptr);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6821,46 +6099,1720 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-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>+// OpenGL ES 3.0 functions
+
+void __stdcall glReadBuffer(GLenum mode)
</ins><span class="cx"> {
</span><del>- EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
- "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
- "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
- srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
</del><ins>+ EVENT("(GLenum mode = 0x%X)", mode);
</ins><span class="cx">
</span><span class="cx"> try
</span><span class="cx"> {
</span><del>- switch (filter)
</del><ins>+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
</ins><span class="cx"> {
</span><del>- case GL_NEAREST:
</del><ins>+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glReadBuffer
+ UNIMPLEMENTED();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+{
+ EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, "
+ "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glDrawRangeElements
+ UNIMPLEMENTED();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, "
+ "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
+ target, level, internalformat, width, height, depth, border, format, type, pixels);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getTexture3D();
+ texture->setImage(level, width, height, depth, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->setImage(level, width, height, depth, internalformat, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+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)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
+ "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getTexture3D();
+ texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getUnpackState(), pixels);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, level, xoffset, yoffset, zoffset, x, y, width, height);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getReadFramebuffer();
+ gl::Texture *texture = NULL;
+ switch (target)
+ {
+ case GL_TEXTURE_3D:
+ texture = context->getTexture3D();
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ texture = context->getTexture2DArray();
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
+ "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, "
+ "const GLvoid* data = 0x%0.8p)",
+ target, level, internalformat, width, height, depth, border, imageSize, data);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, context->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->getTexture3D();
+ texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+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)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
+ "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
+ "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, context->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->getTexture3D();
+ texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenQueries(GLsizei n, GLuint* ids)
+{
+ EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
+ {
+ ids[i] = context->createQuery();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteQueries(GLsizei n, const GLuint* ids)
+{
+ EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
+ {
+ context->deleteQuery(ids[i]);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glIsQuery(GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glBeginQuery(GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->beginQuery(target, id);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glEndQuery(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->endQuery(target);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetQueryiv(GLenum target, GLenum pname, GLint* params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getActiveQuery(target);
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
+
+ if (!queryObject)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (context->getActiveQuery(queryObject->getType()) == id)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch(pname)
+ {
+ case GL_QUERY_RESULT:
+ params[0] = queryObject->getResult();
+ break;
+ case GL_QUERY_RESULT_AVAILABLE:
+ params[0] = queryObject->isResultAvailable();
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glUnmapBuffer(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return glUnmapBufferOES(target);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ glGetBufferPointervOES(target, pname, params);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDrawBuffers(GLsizei n, const GLenum* bufs)
+{
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ glDrawBuffersEXT(n, bufs);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniformMatrix2x3fv(location, count, transpose, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniformMatrix3x2fv(location, count, transpose, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniformMatrix2x4fv(location, count, transpose, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniformMatrix4x2fv(location, count, transpose, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniformMatrix3x4fv(location, count, transpose, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
+ location, count, transpose, value);
+
+ try
+ {
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (location == -1)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniformMatrix4x3fv(location, count, transpose, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+ EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, "
+ "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
+ srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1, mask, filter,
+ false))
+ {
+ return;
+ }
+
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
+ target, samples, internalformat, width, height);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
+ width, height, false))
+ {
+ return;
+ }
+
+ context->setRenderbufferStorage(width, height, internalformat, samples);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+ EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)",
+ target, attachment, texture, level, layer);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateES3FramebufferTextureParameters(context, target, attachment, GL_NONE, texture, level, layer, true))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ gl::Texture *textureObject = context->getTexture(texture);
+ GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE;
+
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer);
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break;
+ case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break;
+ case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break;
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLvoid* __stdcall glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)",
+ target, offset, length, access);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return glMapBufferRangeEXT(target, offset, length, access);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return NULL;
+}
+
+void __stdcall glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ glFlushMappedBufferRangeEXT(target, offset, length);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindVertexArray(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::VertexArray *vao = context->getVertexArray(array);
+
+ if (!vao)
+ {
+ // The default VAO should always exist
+ ASSERT(array != 0);
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->bindVertexArray(array);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
+{
+ EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ if (arrays[arrayIndex] != 0)
+ {
+ context->deleteVertexArray(arrays[arrayIndex]);
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenVertexArrays(GLsizei n, GLuint* arrays)
+{
+ EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ arrays[arrayIndex] = context->createVertexArray();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glIsVertexArray(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ if (array == 0)
+ {
+ return GL_FALSE;
+ }
+
+ gl::VertexArray *vao = context->getVertexArray(array);
+
+ return (vao != NULL ? GL_TRUE : GL_FALSE);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)",
+ target, index, data);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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 >= context->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 >= context->getMaximumCombinedUniformBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!(context->getIndexedIntegerv(target, index, data)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getIndexedQueryParameterInfo(target, &nativeType, &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<GLint64>(std::numeric_limits<int>::min());
+ GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max());
+ GLint64 *int64Params = new GLint64[numParams];
+
+ context->getIndexedInteger64v(target, index, int64Params);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue);
+ data[i] = static_cast<GLint>(clampedValue);
+ }
+
+ delete [] int64Params;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBeginTransformFeedback(GLenum primitiveMode)
+{
+ EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ if (transformFeedback->isStarted())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (transformFeedback->isPaused())
+ {
+ transformFeedback->resume();
+ }
+ else
+ {
+ transformFeedback->start(primitiveMode);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glEndTransformFeedback(void)
+{
+ EVENT("(void)");
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ if (!transformFeedback->isStarted())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->stop();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)",
+ target, index, buffer, offset, size);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (buffer != 0 && size <= 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 && ((offset % 4) != 0 || (size % 4) != 0))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size);
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ break;
+
+ case GL_UNIFORM_BUFFER:
+
+ // it is an error to bind an offset not a multiple of the alignment
+ if (buffer != 0 && (offset % context->getUniformBufferOffsetAlignment()) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->bindIndexedUniformBuffer(buffer, index, offset, size);
+ context->bindGenericUniformBuffer(buffer);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)",
+ target, index, buffer);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0);
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ context->bindIndexedUniformBuffer(buffer, index, 0, 0);
+ context->bindGenericUniformBuffer(buffer);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+{
+ EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)",
+ program, count, varyings, bufferMode);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (bufferMode)
+ {
+ case GL_INTERLEAVED_ATTRIBS:
+ break;
+ case GL_SEPARATE_ATTRIBS:
+ if (static_cast<GLuint>(count) > context->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->getProgram(program);
+ ASSERT(programObject);
+
+ programObject->setTransformFeedbackVaryings(count, varyings, bufferMode);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+{
+ EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, "
+ "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)",
+ program, index, bufSize, length, size, type, name);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (!gl::ValidProgram(context, program))
+ {
+ return;
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+ ASSERT(programObject);
+
+ if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+ EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)",
+ index, size, type, stride, pointer);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (size < 1 || size > 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:
</ins><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="cx"> return gl::error(GL_INVALID_ENUM);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
</del><ins>+ if (stride < 0)
</ins><span class="cx"> {
</span><span class="cx"> return gl::error(GL_INVALID_VALUE);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
</del><ins>+ if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
</ins><span class="cx"> {
</span><del>- ERR("Scaling and flipping in BlitFramebufferANGLE not supported by this implementation");
</del><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ 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->getVertexArrayHandle() != 0 && context->getArrayBufferHandle() == 0 && pointer != NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, true,
+ stride, pointer);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
+ index, pname, params);
+
+ try
+ {
</ins><span class="cx"> gl::Context *context = gl::getNonLostContext();
</span><span class="cx">
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><del>- if (context->getReadFramebufferHandle() == context->getDrawFramebufferHandle())
</del><ins>+ if (context->getClientVersion() < 3)
</ins><span class="cx"> {
</span><del>- ERR("Blits with the same source and destination framebuffer are not supported by this implementation.");
</del><span class="cx"> return gl::error(GL_INVALID_OPERATION);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask);
</del><ins>+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
+
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
+ {
+ params[i] = currentValueData.IntValues[i];
+ }
+ }
+ else
+ {
+ *params = attribState.querySingleParameter<GLint>(pname);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span><span class="lines">@@ -6869,6 +7821,2296 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void __stdcall glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)",
+ index, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
+
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
+
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData &currentValueData = context->getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
+ {
+ params[i] = currentValueData.UnsignedIntValues[i];
+ }
+ }
+ else
+ {
+ *params = attribState.querySingleParameter<GLuint>(pname);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+ EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)",
+ index, x, y, z, w);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ GLint vals[4] = { x, y, z, w };
+ context->setVertexAttribi(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+ EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)",
+ index, x, y, z, w);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ GLuint vals[4] = { x, y, z, w };
+ context->setVertexAttribu(index, vals);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribI4iv(GLuint index, const GLint* v)
+{
+ EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->setVertexAttribi(index, v);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribI4uiv(GLuint index, const GLuint* v)
+{
+ EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->setVertexAttribu(index, v);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetUniformuiv(GLuint program, GLint location, GLuint* params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)",
+ program, location, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (program == 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->getUniformuiv(location, NULL, params))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLint __stdcall glGetFragDataLocation(GLuint program, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)",
+ program, name);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ if (program == 0)
+ {
+ return gl::error(GL_INVALID_VALUE, -1);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ return programBinary->getFragDataLocation(name);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, 0);
+ }
+
+ return 0;
+}
+
+void __stdcall glUniform1ui(GLint location, GLuint v0)
+{
+ glUniform1uiv(location, 1, &v0);
+}
+
+void __stdcall glUniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ const GLuint xy[] = { v0, v1 };
+ glUniform2uiv(location, 1, xy);
+}
+
+void __stdcall glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ const GLuint xyz[] = { v0, v1, v2 };
+ glUniform3uiv(location, 1, xyz);
+}
+
+void __stdcall glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ const GLuint xyzw[] = { v0, v1, v2, v3 };
+ glUniform4uiv(location, 1, xyzw);
+}
+
+void __stdcall glUniform1uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
+ location, count, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniform1uiv(location, count, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform2uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
+ location, count, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniform2uiv(location, count, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform3uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)",
+ location, count, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniform3uiv(location, count, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniform4uiv(GLint location, GLsizei count, const GLuint* value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
+ location, count, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->setUniform4uiv(location, count, value))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)",
+ buffer, drawbuffer, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || drawbuffer >= static_cast<GLint>(context->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->clearBufferiv(buffer, drawbuffer, value);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)",
+ buffer, drawbuffer, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || drawbuffer >= static_cast<GLint>(context->getMaximumRenderTargets()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferuiv(buffer, drawbuffer, value);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)",
+ buffer, drawbuffer, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || drawbuffer >= static_cast<GLint>(context->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->clearBufferfv(buffer, drawbuffer, value);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)",
+ buffer, drawbuffer, depth, stencil);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->clearBufferfi(buffer, drawbuffer, depth, stencil);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+const GLubyte* __stdcall glGetStringi(GLenum name, GLuint index)
+{
+ EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ if (name != GL_EXTENSIONS)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ if (index >= context->getNumExtensions())
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ return reinterpret_cast<const GLubyte*>(context->getExtensionString(index));
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ return NULL;
+}
+
+void __stdcall glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+{
+ EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)",
+ readTarget, writeTarget, readOffset, writeOffset, size);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getTargetBuffer(readTarget);
+ gl::Buffer *writeBuffer = context->getTargetBuffer(writeTarget);
+
+ if (!readBuffer || !writeBuffer)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (readBuffer->mapped() || writeBuffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (readOffset < 0 || writeOffset < 0 || size < 0 ||
+ static_cast<unsigned int>(readOffset + size) > readBuffer->size() ||
+ static_cast<unsigned int>(writeOffset + size) > writeBuffer->size())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (readBuffer == writeBuffer && abs(readOffset - writeOffset) < 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 > 0)
+ {
+ writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+{
+ EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)",
+ program, uniformCount, uniformNames, uniformIndices);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformCount < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programObject->isLinked() || !programBinary)
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ uniformIndices[uniformId] = GL_INVALID_INDEX;
+ }
+ }
+ else
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]);
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
+ program, uniformCount, uniformIndices, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformCount < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->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->getProgramBinary();
+
+ if (!programBinary && uniformCount > 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+
+ if (index >= (GLuint)programBinary->getActiveUniformCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+ params[uniformId] = programBinary->getActiveUniformi(index, pname);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLuint __stdcall glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+{
+ EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->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->getProgramBinary();
+ if (!programBinary)
+ {
+ return GL_INVALID_INDEX;
+ }
+
+ return programBinary->getUniformBlockIndex(uniformBlockName);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, 0);
+ }
+
+ return 0;
+}
+
+void __stdcall glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
+ program, uniformBlockIndex, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_UNIFORM_BLOCK_BINDING:
+ *params = static_cast<GLint>(programObject->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->getActiveUniformBlockiv(uniformBlockIndex, pname, params);
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+{
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)",
+ program, uniformBlockIndex, bufSize, length, uniformBlockName);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)",
+ program, uniformBlockIndex, uniformBlockBinding);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformBlockBinding >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ // if never linked, there won't be any uniform blocks
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+{
+ EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)",
+ mode, first, count, instanceCount);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glDrawArraysInstanced
+ UNIMPLEMENTED();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+{
+ EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)",
+ mode, count, type, indices, instanceCount);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glDrawElementsInstanced
+ UNIMPLEMENTED();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLsync __stdcall glFenceSync(GLenum condition, GLbitfield flags)
+{
+ EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLsync>(0));
+ }
+
+ if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLsync>(0));
+ }
+
+ if (flags != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLsync>(0));
+ }
+
+ return context->createFenceSync(condition);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLsync>(NULL));
+ }
+
+ return NULL;
+}
+
+GLboolean __stdcall glIsSync(GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%0.8p)", sync);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return (context->getFenceSync(sync) != NULL);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glDeleteSync(GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%0.8p)", sync);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->deleteFenceSync(sync);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLenum __stdcall glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ sync, flags, timeout);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_WAIT_FAILED);
+ }
+
+ if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
+ }
+
+ return fenceSync->clientWait(flags, timeout);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ sync, flags, timeout);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ fenceSync->serverWait();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetInteger64v(GLenum pname, GLint64* params)
+{
+ EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)",
+ pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getQueryParameterInfo(pname, &nativeType, &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->getInteger64v(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+{
+ EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)",
+ sync, pname, bufSize, length, values);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break;
+ case GL_SYNC_STATUS: values[0] = static_cast<GLint>(fenceSync->getStatus()); break;
+ case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break;
+ case GL_SYNC_FLAGS: values[0] = 0; break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)",
+ target, index, data);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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 >= context->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 >= context->getMaximumCombinedUniformBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!(context->getIndexedInteger64v(target, index, data)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getIndexedQueryParameterInfo(target, &nativeType, &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->getIndexedIntegerv(target, index, intParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ data[i] = static_cast<GLint64>(intParams[i]);
+ }
+
+ delete [] intParams;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)",
+ target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ // A null buffer means that "0" is bound to the requested buffer target
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ *params = static_cast<GLint64>(buffer->usage());
+ break;
+ case GL_BUFFER_SIZE:
+ *params = buffer->size();
+ break;
+ case GL_BUFFER_ACCESS_FLAGS:
+ *params = static_cast<GLint64>(buffer->accessFlags());
+ break;
+ case GL_BUFFER_MAPPED:
+ *params = static_cast<GLint64>(buffer->mapped());
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *params = buffer->mapOffset();
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *params = buffer->mapLength();
+ break;
+ default: UNREACHABLE(); break;
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenSamplers(GLsizei count, GLuint* samplers)
+{
+ EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ samplers[i] = context->createSampler();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteSamplers(GLsizei count, const GLuint* samplers)
+{
+ EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ context->deleteSampler(samplers[i]);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glIsSampler(GLuint sampler)
+{
+ EVENT("(GLuint sampler = %u)", sampler);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return context->isSampler(sampler);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glBindSampler(GLuint unit, GLuint sampler)
+{
+ EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (sampler != 0 && !context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (unit >= context->getMaximumCombinedTextureImageUnits())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->bindSampler(unit, sampler);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!gl::ValidateTexParamParameters(context, pname, param))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->samplerParameteri(sampler, pname, param);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+{
+ glSamplerParameteri(sampler, pname, *param);
+}
+
+void __stdcall glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->samplerParameterf(sampler, pname, param);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+{
+ glSamplerParameterf(sampler, pname, *param);
+}
+
+void __stdcall glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ *params = context->getSamplerParameteri(sampler, pname);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+{
+ EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ *params = context->getSamplerParameterf(sampler, pname);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
+
+ try
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->setVertexAttribDivisor(index, divisor);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glBindTransformFeedback(GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->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->getTransformFeedback(id) == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->bindTransformFeedback(id);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteTransformFeedback(ids[i]);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGenTransformFeedbacks(GLsizei n, GLuint* ids)
+{
+ EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ for (int i = 0; i < n; i++)
+ {
+ ids[i] = context->createTransformFeedback();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+GLboolean __stdcall glIsTransformFeedback(GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ return ((context->getTransformFeedback(id) != NULL) ? GL_TRUE : GL_FALSE);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void __stdcall glPauseTransformFeedback(void)
+{
+ EVENT("(void)");
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86)
+ if (!transformFeedback->isStarted() || transformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->pause();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glResumeTransformFeedback(void)
+{
+ EVENT("(void)");
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86)
+ if (!transformFeedback->isStarted() || !transformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->resume();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)",
+ program, bufSize, length, binaryFormat, binary);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glGetProgramBinary
+ UNIMPLEMENTED();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+{
+ EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)",
+ program, binaryFormat, binary, length);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glProgramBinary
+ UNIMPLEMENTED();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+ EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)",
+ program, pname, value);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // glProgramParameteri
+ UNIMPLEMENTED();
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)",
+ target, numAttachments, attachments);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+ {
+ return;
+ }
+
+ int maxDimension = context->getMaximumRenderbufferDimension();
+ context->invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, "
+ "GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, numAttachments, attachments, x, y, width, height);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+ {
+ return;
+ }
+
+ context->invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
+ target, levels, internalformat, width, height);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getTexture2D();
+ texture2d->storage(levels, internalformat, width, height);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ {
+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ textureCube->storage(levels, internalformat, width);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+ EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
+ "GLsizei height = %d, GLsizei depth = %d)",
+ target, levels, internalformat, width, height, depth);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 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->getTexture3D();
+ texture3d->storage(levels, internalformat, width, height, depth);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture2darray = context->getTexture2DArray();
+ texture2darray->storage(levels, internalformat, width, height, depth);
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void __stdcall glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, "
+ "GLint* params = 0x%0.8p)",
+ target, internalformat, pname, bufSize, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!gl::IsColorRenderingSupported(internalformat, context) &&
+ !gl::IsDepthRenderingSupported(internalformat, context) &&
+ !gl::IsStencilRenderingSupported(internalformat, context))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (target != GL_RENDERBUFFER)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_NUM_SAMPLE_COUNTS:
+ if (bufSize != 0)
+ *params = context->getNumSampleCounts(internalformat);
+ break;
+ case GL_SAMPLES:
+ context->getSampleCounts(internalformat, bufSize, params);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+// 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)
+{
+ EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
+ "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
+ "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
+ srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1, mask, filter,
+ true))
+ {
+ return;
+ }
+
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
</ins><span class="cx"> void __stdcall glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
</span><span class="cx"> GLint border, GLenum format, GLenum type, const GLvoid* pixels)
</span><span class="cx"> {
</span><span class="lines">@@ -7018,6 +10260,265 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void __stdcall glGetBufferPointervOES(GLenum target, GLenum pname, void** params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!context->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->getTargetBuffer(target);
+
+ if (!buffer || !buffer->mapped())
+ {
+ *params = NULL;
+ }
+
+ *params = buffer->mapPointer();
+ }
+ }
+ catch (std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
+void * __stdcall glMapBufferOES(GLenum target, GLenum access)
+{
+ EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (access != GL_WRITE_ONLY_OES)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return buffer->mapRange(0, buffer->size(), GL_MAP_WRITE_BIT);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return NULL;
+}
+
+GLboolean __stdcall glUnmapBufferOES(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", 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->getTargetBuffer(target);
+
+ if (buffer == NULL || !buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ // TODO: detect if we had corruption. if so, throw an error and return false.
+
+ buffer->unmap();
+
+ return GL_TRUE;
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ }
+
+ return GL_FALSE;
+}
+
+void* __stdcall glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)",
+ 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<GLvoid*>(NULL));
+ }
+
+ if (offset < 0 || length < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for buffer overflow
+ size_t offsetSize = static_cast<size_t>(offset);
+ size_t lengthSize = static_cast<size_t>(length);
+
+ if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+ offsetSize + lengthSize > static_cast<size_t>(buffer->size()))
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(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 & ~(allAccessBits))
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (length == 0 || buffer->mapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for invalid bit combinations
+ if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT;
+
+ if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return buffer->mapRange(offset, length, access);
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return NULL;
+}
+
+void __stdcall glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length);
+
+ try
+ {
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (offset < 0 || length < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!buffer->mapped() || (buffer->accessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Check for buffer overflow
+ size_t offsetSize = static_cast<size_t>(offset);
+ size_t lengthSize = static_cast<size_t>(length);
+
+ if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+ offsetSize + lengthSize > static_cast<size_t>(buffer->mapLength()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // We do not currently support a non-trivial implementation of FlushMappedBufferRange
+ }
+ }
+ catch(std::bad_alloc&)
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+}
+
</ins><span class="cx"> __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname)
</span><span class="cx"> {
</span><span class="cx"> struct Extension
</span><span class="lines">@@ -7056,7 +10557,12 @@
</span><span class="cx"> {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE},
</span><span class="cx"> {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE},
</span><span class="cx"> {"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES},
</span><del>- {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES}, };
</del><ins>+ {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES},
+ {"glGetBufferPointervOES", (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES},
+ {"glMapBufferOES", (__eglMustCastToProperFunctionPointerType)glMapBufferOES},
+ {"glUnmapBufferOES", (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES},
+ {"glMapBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT},
+ {"glFlushMappedBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT}, };
</ins><span class="cx">
</span><span class="cx"> for (unsigned int ext = 0; ext < ArraySize(glExtensions); ext++)
</span><span class="cx"> {
</span><span class="lines">@@ -7083,16 +10589,14 @@
</span><span class="cx"> if (context)
</span><span class="cx"> {
</span><span class="cx"> gl::Texture2D *textureObject = context->getTexture2D();
</span><ins>+ ASSERT(textureObject != NULL);
</ins><span class="cx">
</span><span class="cx"> if (textureObject->isImmutable())
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (textureObject)
- {
- textureObject->bindTexImage(surface);
- }
</del><ins>+ textureObject->bindTexImage(surface);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> catch(std::bad_alloc&)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2def"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -173,7 +173,118 @@
</span><span class="cx"> glProgramBinaryOES @175
</span><span class="cx"> glGetProgramBinaryOES @176
</span><span class="cx"> glDrawBuffersEXT @179
</span><ins>+ glMapBufferOES @285
+ glUnmapBufferOES @286
+ glGetBufferPointervOES @287
+ glMapBufferRangeEXT @288
+ glFlushMappedBufferRangeEXT @289
</ins><span class="cx">
</span><ins>+ ; GLES 3.0 Functions
+ glReadBuffer @180
+ glDrawRangeElements @181
+ glTexImage3D @182
+ glTexSubImage3D @183
+ glCopyTexSubImage3D @184
+ glCompressedTexImage3D @185
+ glCompressedTexSubImage3D @186
+ glGenQueries @187
+ glDeleteQueries @188
+ glIsQuery @189
+ glBeginQuery @190
+ glEndQuery @191
+ glGetQueryiv @192
+ glGetQueryObjectuiv @193
+ glUnmapBuffer @194
+ glGetBufferPointerv @195
+ glDrawBuffers @196
+ glUniformMatrix2x3fv @197
+ glUniformMatrix3x2fv @198
+ glUniformMatrix2x4fv @199
+ glUniformMatrix4x2fv @200
+ glUniformMatrix3x4fv @201
+ glUniformMatrix4x3fv @202
+ glBlitFramebuffer @203
+ glRenderbufferStorageMultisample @204
+ glFramebufferTextureLayer @205
+ glMapBufferRange @206
+ glFlushMappedBufferRange @207
+ glBindVertexArray @208
+ glDeleteVertexArrays @209
+ glGenVertexArrays @210
+ glIsVertexArray @211
+ glGetIntegeri_v @212
+ glBeginTransformFeedback @213
+ glEndTransformFeedback @214
+ glBindBufferRange @215
+ glBindBufferBase @216
+ glTransformFeedbackVaryings @217
+ glGetTransformFeedbackVarying @218
+ glVertexAttribIPointer @219
+ glGetVertexAttribIiv @220
+ glGetVertexAttribIuiv @221
+ glVertexAttribI4i @222
+ glVertexAttribI4ui @223
+ glVertexAttribI4iv @224
+ glVertexAttribI4uiv @225
+ glGetUniformuiv @226
+ glGetFragDataLocation @227
+ glUniform1ui @228
+ glUniform2ui @229
+ glUniform3ui @230
+ glUniform4ui @231
+ glUniform1uiv @232
+ glUniform2uiv @233
+ glUniform3uiv @234
+ glUniform4uiv @235
+ glClearBufferiv @236
+ glClearBufferuiv @237
+ glClearBufferfv @238
+ glClearBufferfi @239
+ glGetStringi @240
+ glCopyBufferSubData @241
+ glGetUniformIndices @242
+ glGetActiveUniformsiv @243
+ glGetUniformBlockIndex @244
+ glGetActiveUniformBlockiv @245
+ glGetActiveUniformBlockName @246
+ glUniformBlockBinding @247
+ glDrawArraysInstanced @248
+ glDrawElementsInstanced @249
+ glFenceSync @250
+ glIsSync @251
+ glDeleteSync @252
+ glClientWaitSync @253
+ glWaitSync @254
+ glGetInteger64v @255
+ glGetSynciv @256
+ glGetInteger64i_v @257
+ glGetBufferParameteri64v @258
+ glGenSamplers @259
+ glDeleteSamplers @260
+ glIsSampler @261
+ glBindSampler @262
+ glSamplerParameteri @263
+ glSamplerParameteriv @264
+ glSamplerParameterf @265
+ glSamplerParameterfv @266
+ glGetSamplerParameteriv @267
+ glGetSamplerParameterfv @268
+ glVertexAttribDivisor @269
+ glBindTransformFeedback @270
+ glDeleteTransformFeedbacks @271
+ glGenTransformFeedbacks @272
+ glIsTransformFeedback @273
+ glPauseTransformFeedback @274
+ glResumeTransformFeedback @275
+ glGetProgramBinary @276
+ glProgramBinary @277
+ glProgramParameteri @278
+ glInvalidateFramebuffer @279
+ glInvalidateSubFramebuffer @280
+ glTexStorage2D @281
+ glTexStorage3D @282
+ glGetInternalformativ @283
+
</ins><span class="cx"> ; EGL dependencies
</span><span class="cx"> glCreateContext @144 NONAME
</span><span class="cx"> glDestroyContext @145 NONAME
</span><span class="lines">@@ -185,4 +296,4 @@
</span><span class="cx"> glDestroyRenderer @178 NONAME
</span><span class="cx">
</span><span class="cx"> ; Setting up TRACE macro callbacks
</span><del>- SetTraceFunctionPointers @180
</del><ins>+ SetTraceFunctionPointers @284
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2mainh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> extern "C"
</span><span class="cx"> {
</span><span class="cx"> // Exported functions for use by EGL
</span><del>-gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
</del><ins>+gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
</ins><span class="cx"> void glDestroyContext(gl::Context *context);
</span><span class="cx"> void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
</span><span class="cx"> gl::Context *glGetCurrentContext();
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2precompiledh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -7,7 +7,11 @@
</span><span class="cx"> // precompiled.h: Precompiled header file for libGLESv2.
</span><span class="cx">
</span><span class="cx"> #define GL_APICALL
</span><ins>+#include <GLES3/gl3.h>
+#include <GLES3/gl3ext.h>
</ins><span class="cx"> #include <GLES2/gl2.h>
</span><ins>+
+#define GL_GLEXT_PROTOTYPES
</ins><span class="cx"> #include <GLES2/gl2ext.h>
</span><span class="cx">
</span><span class="cx"> #define EGLAPI
</span><span class="lines">@@ -16,6 +20,7 @@
</span><span class="cx"> #include <assert.h>
</span><span class="cx"> #include <cstddef>
</span><span class="cx"> #include <float.h>
</span><ins>+#include <stdint.h>
</ins><span class="cx"> #include <intrin.h>
</span><span class="cx"> #include <math.h>
</span><span class="cx"> #include <stdarg.h>
</span><span class="lines">@@ -32,12 +37,15 @@
</span><span class="cx"> #include <unordered_map>
</span><span class="cx"> #include <vector>
</span><span class="cx">
</span><ins>+#if defined(ANGLE_ENABLE_D3D9)
</ins><span class="cx"> #include <d3d9.h>
</span><del>-#include <d3d11.h>
</del><ins>+#include <D3Dcompiler.h>
+#endif // ANGLE_ENABLE_D3D9
+
+#if defined(ANGLE_ENABLE_D3D11)
+#include <D3D10_1.h>
+#include <D3D11.h>
</ins><span class="cx"> #include <dxgi.h>
</span><span class="cx"> #include <dxgi1_2.h>
</span><del>-#include <d3dcompiler.h>
-
-#ifdef _MSC_VER
-#include <hash_map>
-#endif
</del><ins>+#include <D3Dcompiler.h>
+#endif // ANGLE_ENABLE_D3D11
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2queryconversionscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+#include "precompiled.h"
+//
+// 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 "libGLESv2/Context.h"
+#include "common/utilities.h"
+
+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 <typename GLType>
+struct CastStateValueEnum { static GLenum mEnumForType; };
+
+template <> GLenum CastStateValueEnum<GLint>::mEnumForType = GL_INT;
+template <> GLenum CastStateValueEnum<GLuint>::mEnumForType = GL_UNSIGNED_INT;
+template <> GLenum CastStateValueEnum<GLboolean>::mEnumForType = GL_BOOL;
+template <> GLenum CastStateValueEnum<GLint64>::mEnumForType = GL_INT_64_ANGLEX;
+template <> GLenum CastStateValueEnum<GLfloat>::mEnumForType = GL_FLOAT;
+
+template <typename QueryT, typename NativeT>
+QueryT CastStateValueToInt(GLenum pname, NativeT value)
+{
+ GLenum queryType = CastStateValueEnum<QueryT>::mEnumForType;
+ GLenum nativeType = CastStateValueEnum<NativeT>::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<QueryT>((static_cast<GLfloat>(0xFFFFFFFF) * value - 1.0f) / 2.0f);
+ }
+ else
+ {
+ return gl::iround<QueryT>(value);
+ }
+ }
+
+ // Clamp 64-bit int values when casting to int
+ if (nativeType == GL_INT_64_ANGLEX && queryType == GL_INT)
+ {
+ GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<GLint>::min());
+ GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<GLint>::max());
+ GLint64 clampedValue = std::max(std::min(static_cast<GLint64>(value), maxIntValue), minIntValue);
+ return static_cast<QueryT>(clampedValue);
+ }
+
+ return static_cast<QueryT>(value);
+}
+
+template <typename QueryT, typename NativeT>
+QueryT CastStateValue(GLenum pname, NativeT value)
+{
+ GLenum queryType = CastStateValueEnum<QueryT>::mEnumForType;
+
+ switch (queryType)
+ {
+ case GL_INT: return CastStateValueToInt<QueryT, NativeT>(pname, value);
+ case GL_INT_64_ANGLEX: return CastStateValueToInt<QueryT, NativeT>(pname, value);
+ case GL_FLOAT: return static_cast<QueryT>(value);
+ case GL_BOOL: return (value == static_cast<NativeT>(0) ? GL_FALSE : GL_TRUE);
+ default: UNREACHABLE(); return 0;
+ }
+}
+
+template <typename QueryT>
+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->getIntegerv(pname, intParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastStateValue<QueryT>(pname, intParams[i]);
+ }
+
+ delete [] intParams;
+ }
+ else if (nativeType == GL_BOOL)
+ {
+ GLboolean *boolParams = NULL;
+ boolParams = new GLboolean[numParams];
+
+ context->getBooleanv(pname, boolParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = (boolParams[i] == GL_FALSE ? static_cast<QueryT>(0) : static_cast<QueryT>(1));
+ }
+
+ delete [] boolParams;
+ }
+ else if (nativeType == GL_FLOAT)
+ {
+ GLfloat *floatParams = NULL;
+ floatParams = new GLfloat[numParams];
+
+ context->getFloatv(pname, floatParams);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastStateValue<QueryT>(pname, floatParams[i]);
+ }
+
+ delete [] floatParams;
+ }
+ else if (nativeType == GL_INT_64_ANGLEX)
+ {
+ GLint64 *int64Params = NULL;
+ int64Params = new GLint64[numParams];
+
+ context->getInteger64v(pname, int64Params);
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastStateValue<QueryT>(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<GLboolean>(Context *, GLenum, GLenum, unsigned int, GLboolean *);
+template void CastStateValues<GLint>(Context *, GLenum, GLenum, unsigned int, GLint *);
+template void CastStateValues<GLuint>(Context *, GLenum, GLenum, unsigned int, GLuint *);
+template void CastStateValues<GLfloat>(Context *, GLenum, GLenum, unsigned int, GLfloat *);
+template void CastStateValues<GLint64>(Context *, GLenum, GLenum, unsigned int, GLint64 *);
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2queryconversionsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.h        2014-04-30 22:57:08 UTC (rev 168055)
</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 <typename QueryT>
+void CastStateValues(Context *context, GLenum nativeType, GLenum pname,
+ unsigned int numParams, QueryT *outParams);
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererBufferStoragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -33,8 +33,4 @@
</span><span class="cx"> mSerial = mNextSerial++;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void BufferStorage::markBufferUsage()
-{
</del><span class="cx"> }
</span><del>-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererBufferStorageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/BufferStorage.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 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">@@ -23,12 +23,18 @@
</span><span class="cx"> // The data returned is only guaranteed valid until next non-const method.
</span><span class="cx"> virtual void *getData() = 0;
</span><span class="cx"> virtual void setData(const void* data, unsigned int size, unsigned int offset) = 0;
</span><ins>+ virtual void copyData(BufferStorage* sourceStorage, unsigned int size,
+ unsigned int sourceOffset, unsigned int destOffset) = 0;
</ins><span class="cx"> virtual void clear() = 0;
</span><ins>+ virtual void markTransformFeedbackUsage() = 0;
</ins><span class="cx"> virtual unsigned int getSize() const = 0;
</span><span class="cx"> virtual bool supportsDirectBinding() const = 0;
</span><del>- virtual void markBufferUsage();
</del><span class="cx"> unsigned int getSerial() const;
</span><span class="cx">
</span><ins>+ virtual bool isMapped() const = 0;
+ virtual void *map(GLbitfield access) = 0;
+ virtual void unmap() = 0;
+
</ins><span class="cx"> protected:
</span><span class="cx"> void updateSerial();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererFenceImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/FenceImpl.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/FenceImpl.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/FenceImpl.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -17,27 +17,16 @@
</span><span class="cx"> class FenceImpl
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- FenceImpl() : mStatus(GL_FALSE), mCondition(GL_NONE) { };
</del><ins>+ FenceImpl() { };
</ins><span class="cx"> virtual ~FenceImpl() { };
</span><span class="cx">
</span><del>- virtual GLboolean isFence() = 0;
- virtual void setFence(GLenum condition) = 0;
- virtual GLboolean testFence() = 0;
- virtual void finishFence() = 0;
- virtual void getFenceiv(GLenum pname, GLint *params) = 0;
</del><ins>+ virtual bool isSet() const = 0;
+ virtual void set() = 0;
+ virtual bool test(bool flushCommandBuffer) = 0;
+ virtual bool hasError() const = 0;
</ins><span class="cx">
</span><del>- protected:
- void setStatus(GLboolean status) { mStatus = status; }
- GLboolean getStatus() const { return mStatus; }
-
- void setCondition(GLuint condition) { mCondition = condition; }
- GLuint getCondition() const { return mCondition; }
-
</del><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(FenceImpl);
</span><del>-
- GLboolean mStatus;
- GLenum mCondition;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -18,531 +18,12 @@
</span><span class="cx"> {
</span><span class="cx"> mWidth = 0;
</span><span class="cx"> mHeight = 0;
</span><ins>+ mDepth = 0;
</ins><span class="cx"> mInternalFormat = GL_NONE;
</span><span class="cx"> mActualFormat = GL_NONE;
</span><ins>+ mTarget = GL_NONE;
+ mRenderable = false;
+ mDirty = false;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Image::loadAlphaDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = 0;
- dest[4 * x + 1] = 0;
- dest[4 * x + 2] = 0;
- dest[4 * x + 3] = source[x];
- }
- }
</del><span class="cx"> }
</span><del>-
-void Image::loadAlphaDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- memcpy(dest, source, width);
- }
-}
-
-void Image::loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = 0;
- dest[4 * x + 1] = 0;
- dest[4 * x + 2] = 0;
- dest[4 * x + 3] = source[x];
- }
- }
-}
-
-void Image::loadAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = 0;
- dest[4 * x + 1] = 0;
- dest[4 * x + 2] = 0;
- dest[4 * x + 3] = source[x];
- }
- }
-}
-
-void Image::loadLuminanceDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
-
- if (!native) // BGRA8 destination format
- {
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x];
- dest[4 * x + 1] = source[x];
- dest[4 * x + 2] = source[x];
- dest[4 * x + 3] = 0xFF;
- }
- }
- else // L8 destination format
- {
- memcpy(dest, source, width);
- }
- }
-}
-
-void Image::loadLuminanceFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x];
- dest[4 * x + 1] = source[x];
- dest[4 * x + 2] = source[x];
- dest[4 * x + 3] = 1.0f;
- }
- }
-}
-
-void Image::loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[3 * x + 0] = source[x];
- dest[3 * x + 1] = source[x];
- dest[3 * x + 2] = source[x];
- }
- }
-}
-
-void Image::loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x];
- dest[4 * x + 1] = source[x];
- dest[4 * x + 2] = source[x];
- dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
- }
- }
-}
-
-void Image::loadLuminanceAlphaDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
-
- if (!native) // BGRA8 destination format
- {
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[2*x+0];
- dest[4 * x + 1] = source[2*x+0];
- dest[4 * x + 2] = source[2*x+0];
- dest[4 * x + 3] = source[2*x+1];
- }
- }
- else
- {
- memcpy(dest, source, width * 2);
- }
- }
-}
-
-void Image::loadLuminanceAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[2*x+0];
- dest[4 * x + 1] = source[2*x+0];
- dest[4 * x + 2] = source[2*x+0];
- dest[4 * x + 3] = source[2*x+1];
- }
- }
-}
-
-void Image::loadLuminanceAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[2*x+0];
- dest[4 * x + 1] = source[2*x+0];
- dest[4 * x + 2] = source[2*x+0];
- dest[4 * x + 3] = source[2*x+1];
- }
- }
-}
-
-void Image::loadRGBUByteDataToBGRX(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 2];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 0];
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGBUByteDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 0];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 2];
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGB565DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
- dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
- dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGB565DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 1] = ((rgba & 0x07E0) >> 3) | ((rgba & 0x07E0) >> 9);
- dest[4 * x + 2] = ((rgba & 0x001F) << 3) | ((rgba & 0x001F) >> 2);
- dest[4 * x + 3] = 0xFF;
- }
- }
-}
-
-void Image::loadRGBFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 0];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 2];
- dest[4 * x + 3] = 1.0f;
- }
- }
-}
-
-void Image::loadRGBFloatDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- memcpy(dest, source, width * 12);
- }
-}
-
-void Image::loadRGBHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned short *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned short*>(static_cast<unsigned char*>(output) + y * outputPitch);
- for (int x = 0; x < width; x++)
- {
- dest[4 * x + 0] = source[x * 3 + 0];
- dest[4 * x + 1] = source[x * 3 + 1];
- dest[4 * x + 2] = source[x * 3 + 2];
- dest[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16bit flpt representation of 1
- }
- }
-}
-
-void Image::loadRGBAUByteDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned int *source = NULL;
- unsigned int *dest = NULL;
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-
- for (int x = 0; x < width; x++)
- {
- unsigned int rgba = source[x];
- dest[x] = (_rotl(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
- }
- }
-}
-
-void Image::loadRGBAUByteDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned int *source = NULL;
- unsigned int *dest = NULL;
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned int*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<unsigned int*>(static_cast<unsigned char*>(output) + y * outputPitch);
-
- memcpy(dest, source, width * 4);
- }
-}
-
-void Image::loadRGBA4444DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
- dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
- dest[4 * x + 2] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
- dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
- }
- }
-}
-
-void Image::loadRGBA4444DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
- dest[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
- dest[4 * x + 2] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
- dest[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
- }
- }
-}
-
-void Image::loadRGBA5551DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
- dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
- dest[4 * x + 2] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
- }
- }
-}
-
-void Image::loadRGBA5551DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned short *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const unsigned short*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- for (int x = 0; x < width; x++)
- {
- unsigned short rgba = source[x];
- dest[4 * x + 0] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
- dest[4 * x + 2] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
- dest[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
- }
- }
-}
-
-void Image::loadRGBAFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const float *source = NULL;
- float *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = reinterpret_cast<const float*>(static_cast<const unsigned char*>(input) + y * inputPitch);
- dest = reinterpret_cast<float*>(static_cast<unsigned char*>(output) + y * outputPitch);
- memcpy(dest, source, width * 16);
- }
-}
-
-void Image::loadRGBAHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- memcpy(dest, source, width * 8);
- }
-}
-
-void Image::loadBGRADataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output)
-{
- const unsigned char *source = NULL;
- unsigned char *dest = NULL;
-
- for (int y = 0; y < height; y++)
- {
- source = static_cast<const unsigned char*>(input) + y * inputPitch;
- dest = static_cast<unsigned char*>(output) + y * outputPitch;
- memcpy(dest, source, width*4);
- }
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Image.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx"> class Renderer;
</span><span class="cx"> class TextureStorageInterface2D;
</span><span class="cx"> class TextureStorageInterfaceCube;
</span><ins>+class TextureStorageInterface3D;
+class TextureStorageInterface2DArray;
</ins><span class="cx">
</span><span class="cx"> class Image
</span><span class="cx"> {
</span><span class="lines">@@ -32,8 +34,11 @@
</span><span class="cx">
</span><span class="cx"> GLsizei getWidth() const { return mWidth; }
</span><span class="cx"> GLsizei getHeight() const { return mHeight; }
</span><ins>+ GLsizei getDepth() const { return mDepth; }
</ins><span class="cx"> GLenum getInternalFormat() const { return mInternalFormat; }
</span><span class="cx"> GLenum getActualFormat() const { return mActualFormat; }
</span><ins>+ GLenum getTarget() const { return mTarget; }
+ bool isRenderableFormat() const { return mRenderable; }
</ins><span class="cx">
</span><span class="cx"> void markDirty() {mDirty = true;}
</span><span class="cx"> void markClean() {mDirty = false;}
</span><span class="lines">@@ -41,84 +46,30 @@
</span><span class="cx">
</span><span class="cx"> virtual void setManagedSurface(TextureStorageInterface2D *storage, int level) {};
</span><span class="cx"> virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level) {};
</span><del>- virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
- virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
</del><ins>+ virtual void setManagedSurface(TextureStorageInterface3D *storage, int level) {};
+ virtual void setManagedSurface(TextureStorageInterface2DArray *storage, int layer, int level) {};
+ virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
+ virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
+ virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) = 0;
+ virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height) = 0;
</ins><span class="cx">
</span><del>- virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease) = 0;
</del><ins>+ virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease) = 0;
</ins><span class="cx">
</span><del>- virtual bool isRenderableFormat() const = 0;
-
- virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input) = 0;
- virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
</del><ins>+ virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input) = 0;
+ virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
</ins><span class="cx"> const void *input) = 0;
</span><span class="cx">
</span><del>- virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
</del><ins>+ virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
</ins><span class="cx">
</span><del>- static void loadAlphaDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaDataToBGRASSE2(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native);
- static void loadLuminanceFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceFloatDataToRGB(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceAlphaDataToNativeOrBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output, bool native);
- static void loadLuminanceAlphaFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadLuminanceAlphaHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBUByteDataToBGRX(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBUByteDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGB565DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGB565DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBFloatDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAUByteDataToBGRASSE2(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAUByteDataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAUByteDataToNative(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA4444DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA4444DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA5551DataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBA5551DataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadRGBAHalfFloatDataToRGBA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
- static void loadBGRADataToBGRA(GLsizei width, GLsizei height,
- int inputPitch, const void *input, size_t outputPitch, void *output);
-
</del><span class="cx"> protected:
</span><span class="cx"> GLsizei mWidth;
</span><span class="cx"> GLsizei mHeight;
</span><del>- GLint mInternalFormat;
</del><ins>+ GLsizei mDepth;
+ GLenum mInternalFormat;
</ins><span class="cx"> GLenum mActualFormat;
</span><ins>+ bool mRenderable;
+ GLenum mTarget;
</ins><span class="cx">
</span><span class="cx"> bool mDirty;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexBuffer.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexBuffer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexBuffer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -194,4 +194,3 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><del>-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexDataManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexDataManager.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexDataManager.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexDataManager.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx"> #include "libGLESv2/main.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "libGLESv2/formatutils.h"
</ins><span class="cx"> #include "libGLESv2/renderer/IndexBuffer.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx"> default: UNREACHABLE(); alignedOffset = false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned int typeSize = gl::ComputeTypeSize(type);
</del><ins>+ unsigned int typeSize = gl::GetTypeBytes(type);
</ins><span class="cx">
</span><span class="cx"> // check for integer overflows
</span><span class="cx"> if (static_cast<unsigned int>(count) > (std::numeric_limits<unsigned int>::max() / typeSize) ||
</span><span class="lines">@@ -167,7 +167,6 @@
</span><span class="cx"> {
</span><span class="cx"> indexBuffer = streamingBuffer;
</span><span class="cx"> streamOffset = offset;
</span><del>- storage->markBufferUsage();
</del><span class="cx">
</span><span class="cx"> if (!buffer->getIndexRangeCache()->findRange(type, offset, count, &translated->minIndex,
</span><span class="cx"> &translated->maxIndex, NULL))
</span><span class="lines">@@ -180,10 +179,11 @@
</span><span class="cx"> else if (staticBuffer && staticBuffer->getBufferSize() != 0 && staticBuffer->getIndexType() == type && alignedOffset)
</span><span class="cx"> {
</span><span class="cx"> indexBuffer = staticBuffer;
</span><ins>+
</ins><span class="cx"> if (!staticBuffer->getIndexRangeCache()->findRange(type, offset, count, &translated->minIndex,
</span><span class="cx"> &translated->maxIndex, &streamOffset))
</span><span class="cx"> {
</span><del>- streamOffset = (offset / gl::ComputeTypeSize(type)) * gl::ComputeTypeSize(destinationIndexType);
</del><ins>+ streamOffset = (offset / gl::GetTypeBytes(type)) * gl::GetTypeBytes(destinationIndexType);
</ins><span class="cx"> computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex);
</span><span class="cx"> staticBuffer->getIndexRangeCache()->addRange(type, offset, count, translated->minIndex,
</span><span class="cx"> translated->maxIndex, streamOffset);
</span><span class="lines">@@ -198,7 +198,7 @@
</span><span class="cx"> if (staticBuffer->getBufferSize() == 0 && alignedOffset)
</span><span class="cx"> {
</span><span class="cx"> indexBuffer = staticBuffer;
</span><del>- convertCount = storage->getSize() / gl::ComputeTypeSize(type);
</del><ins>+ convertCount = storage->getSize() / gl::GetTypeBytes(type);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -213,7 +213,7 @@
</span><span class="cx"> return GL_INVALID_OPERATION;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned int indexTypeSize = gl::ComputeTypeSize(destinationIndexType);
</del><ins>+ unsigned int indexTypeSize = gl::GetTypeBytes(destinationIndexType);
</ins><span class="cx"> if (convertCount > std::numeric_limits<unsigned int>::max() / indexTypeSize)
</span><span class="cx"> {
</span><span class="cx"> ERR("Reserving %u indicies of %u bytes each exceeds the maximum buffer size.", convertCount, indexTypeSize);
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">
</span><span class="cx"> if (staticBuffer)
</span><span class="cx"> {
</span><del>- streamOffset = (offset / gl::ComputeTypeSize(type)) * gl::ComputeTypeSize(destinationIndexType);
</del><ins>+ streamOffset = (offset / gl::GetTypeBytes(type)) * gl::GetTypeBytes(destinationIndexType);
</ins><span class="cx"> staticBuffer->getIndexRangeCache()->addRange(type, offset, count, translated->minIndex,
</span><span class="cx"> translated->maxIndex, streamOffset);
</span><span class="cx"> }
</span><span class="lines">@@ -255,12 +255,12 @@
</span><span class="cx"> translated->storage = directStorage ? storage : NULL;
</span><span class="cx"> translated->indexBuffer = indexBuffer->getIndexBuffer();
</span><span class="cx"> translated->serial = directStorage ? storage->getSerial() : indexBuffer->getSerial();
</span><del>- translated->startIndex = streamOffset / gl::ComputeTypeSize(destinationIndexType);
</del><ins>+ translated->startIndex = streamOffset / gl::GetTypeBytes(destinationIndexType);
</ins><span class="cx"> translated->startOffset = streamOffset;
</span><span class="cx">
</span><span class="cx"> if (buffer)
</span><span class="cx"> {
</span><del>- buffer->promoteStaticUsage(count * gl::ComputeTypeSize(type));
</del><ins>+ buffer->promoteStaticUsage(count * gl::GetTypeBytes(type));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return GL_NO_ERROR;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexRangeCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -9,8 +9,8 @@
</span><span class="cx"> // ranges of indices.
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/IndexRangeCache.h"
</span><ins>+#include "libGLESv2/formatutils.h"
</ins><span class="cx"> #include "common/debug.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><span class="cx"> #include <tuple>
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> while (i != mIndexRangeCache.end())
</span><span class="cx"> {
</span><span class="cx"> unsigned int rangeStart = i->second.streamOffset;
</span><del>- unsigned int rangeEnd = i->second.streamOffset + (gl::ComputeTypeSize(i->first.type) * i->first.count);
</del><ins>+ unsigned int rangeEnd = i->second.streamOffset + (gl::GetTypeBytes(i->first.type) * i->first.count);
</ins><span class="cx">
</span><span class="cx"> if (invalidateEnd < rangeStart || invalidateStart > rangeEnd)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererIndexRangeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/IndexRangeCache.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> #define LIBGLESV2_RENDERER_INDEXRANGECACHE_H_
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><ins>+#include <map>
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererRenderTargeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/RenderTarget.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/RenderTarget.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/RenderTarget.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> #define LIBGLESV2_RENDERER_RENDERTARGET_H_
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><ins>+#include "libGLESv2/angletypes.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -21,6 +22,7 @@
</span><span class="cx"> {
</span><span class="cx"> mWidth = 0;
</span><span class="cx"> mHeight = 0;
</span><ins>+ mDepth = 0;
</ins><span class="cx"> mInternalFormat = GL_NONE;
</span><span class="cx"> mActualFormat = GL_NONE;
</span><span class="cx"> mSamples = 0;
</span><span class="lines">@@ -28,21 +30,27 @@
</span><span class="cx">
</span><span class="cx"> virtual ~RenderTarget() {};
</span><span class="cx">
</span><del>- GLsizei getWidth() { return mWidth; }
- GLsizei getHeight() { return mHeight; }
- GLenum getInternalFormat() { return mInternalFormat; }
- GLenum getActualFormat() { return mActualFormat; }
- GLsizei getSamples() { return mSamples; }
-
</del><ins>+ GLsizei getWidth() const { return mWidth; }
+ GLsizei getHeight() const { return mHeight; }
+ GLsizei getDepth() const { return mDepth; }
+ GLenum getInternalFormat() const { return mInternalFormat; }
+ GLenum getActualFormat() const { return mActualFormat; }
+ GLsizei getSamples() const { return mSamples; }
+ gl::Extents getExtents() const { return gl::Extents(mWidth, mHeight, mDepth); }
+
+ virtual void invalidate(GLint x, GLint y, GLsizei width, GLsizei height) = 0;
+
</ins><span class="cx"> struct Desc {
</span><span class="cx"> GLsizei width;
</span><span class="cx"> GLsizei height;
</span><ins>+ GLsizei depth;
</ins><span class="cx"> GLenum format;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> GLsizei mWidth;
</span><span class="cx"> GLsizei mHeight;
</span><ins>+ GLsizei mDepth;
</ins><span class="cx"> GLenum mInternalFormat;
</span><span class="cx"> GLenum mActualFormat;
</span><span class="cx"> GLsizei mSamples;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererRenderercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,14 +11,21 @@
</span><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx"> #include "libGLESv2/Program.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><ins>+#include "common/utilities.h"
+#include "third_party/trace_event/trace_event.h"
+#include "libGLESv2/Shader.h"
+
+#if defined (ANGLE_ENABLE_D3D9)
</ins><span class="cx"> #include "libGLESv2/renderer/d3d9/Renderer9.h"
</span><ins>+#endif // ANGLE_ENABLE_D3D9
+
+#if defined (ANGLE_ENABLE_D3D11)
</ins><span class="cx"> #include "libGLESv2/renderer/d3d11/Renderer11.h"
</span><del>-#include "libGLESv2/utilities.h"
-#include "third_party/trace_event/trace_event.h"
</del><ins>+#endif // ANGLE_ENABLE_D3D11
</ins><span class="cx">
</span><del>-#if !defined(ANGLE_ENABLE_D3D11)
</del><ins>+#if !defined(ANGLE_DEFAULT_D3D11)
</ins><span class="cx"> // Enables use of the Direct3D 11 API for a default display, when available
</span><del>-#define ANGLE_ENABLE_D3D11 0
</del><ins>+#define ANGLE_DEFAULT_D3D11 0
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="lines">@@ -26,194 +33,55 @@
</span><span class="cx">
</span><span class="cx"> Renderer::Renderer(egl::Display *display) : mDisplay(display)
</span><span class="cx"> {
</span><del>- mD3dCompilerModule = NULL;
- mD3DCompileFunc = NULL;
</del><ins>+ mCurrentClientVersion = 2;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderer::~Renderer()
</span><span class="cx"> {
</span><del>- if (mD3dCompilerModule)
- {
- FreeLibrary(mD3dCompilerModule);
- mD3dCompilerModule = NULL;
- }
</del><ins>+ gl::Shader::releaseCompiler();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer::initializeCompiler()
-{
- TRACE_EVENT0("gpu", "initializeCompiler");
-#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
- // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.
- static TCHAR* d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;
-
- for (size_t i = 0; i < ArraySize(d3dCompilerNames); ++i)
- {
- if (GetModuleHandleEx(0, d3dCompilerNames[i], &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("No D3D compiler module found - aborting!\n");
- return false;
- }
-
- mD3DCompileFunc = reinterpret_cast<pCompileFunc>(GetProcAddress(mD3dCompilerModule, "D3DCompile"));
- ASSERT(mD3DCompileFunc);
-
- return mD3DCompileFunc != NULL;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-// Compiles HLSL code into executable binaries
-ShaderBlob *Renderer::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags)
</del><ins>+extern "C"
</ins><span class="cx"> {
</span><del>- if (!hlsl)
- {
- return NULL;
- }
</del><span class="cx">
</span><del>- HRESULT result = S_OK;
- UINT flags = 0;
- std::string sourceText;
- if (gl::perfActive())
</del><ins>+rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId)
+{
+#if defined(ANGLE_ENABLE_D3D11)
+ if (ANGLE_DEFAULT_D3D11 ||
+ displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
</ins><span class="cx"> {
</span><del>- flags |= D3DCOMPILE_DEBUG;
-
-#ifdef NDEBUG
- flags |= optimizationFlags;
-#else
- flags |= D3DCOMPILE_SKIP_OPTIMIZATION;
-#endif
-
- std::string sourcePath = getTempPath();
- sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(hlsl);
- writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
- }
- else
- {
- flags |= optimizationFlags;
- sourceText = hlsl;
- }
-
- // 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.
- const static UINT extraFlags[] =
- {
- 0,
- D3DCOMPILE_AVOID_FLOW_CONTROL,
- D3DCOMPILE_PREFER_FLOW_CONTROL
- };
-
- const static char * const extraFlagNames[] =
- {
- "default",
- "avoid flow control",
- "prefer flow control"
- };
-
- int attempts = alternateFlags ? ArraySize(extraFlags) : 1;
- pD3DCompile compileFunc = reinterpret_cast<pD3DCompile>(mD3DCompileFunc);
- for (int i = 0; i < attempts; ++i)
- {
- ID3DBlob *errorMessage = NULL;
- ID3DBlob *binary = NULL;
-
- result = compileFunc(hlsl, strlen(hlsl), gl::g_fakepath, NULL, NULL,
- "main", profile, flags | extraFlags[i], 0, &binary, &errorMessage);
- if (errorMessage)
</del><ins>+ rx::Renderer11 *renderer = new rx::Renderer11(display, hDc);
+ if (renderer->initialize() == EGL_SUCCESS)
</ins><span class="cx"> {
</span><del>- const char *message = (const char*)errorMessage->GetBufferPointer();
-
- infoLog.appendSanitized(message);
- TRACE("\n%s", hlsl);
- TRACE("\n%s", message);
-
- errorMessage->Release();
- errorMessage = NULL;
</del><ins>+ return renderer;
</ins><span class="cx"> }
</span><del>-
- if (SUCCEEDED(result))
- {
- return (ShaderBlob*)binary;
- }
</del><span class="cx"> else
</span><span class="cx"> {
</span><del>- if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
- {
- return gl::error(GL_OUT_OF_MEMORY, (ShaderBlob*) NULL);
- }
-
- infoLog.append("Warning: D3D shader compilation failed with ");
- infoLog.append(extraFlagNames[i]);
- infoLog.append(" flags.");
- if (i + 1 < attempts)
- {
- infoLog.append(" Retrying with ");
- infoLog.append(extraFlagNames[i + 1]);
- infoLog.append(".\n");
- }
</del><ins>+ // Failed to create a D3D11 renderer, try D3D9
+ SafeDelete(renderer);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><del>- return NULL;
-}
-
-}
-
-extern "C"
-{
-
-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId)
-{
- rx::Renderer *renderer = NULL;
- EGLint status = EGL_BAD_ALLOC;
-
- if (ANGLE_ENABLE_D3D11 ||
- displayId == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
- displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
</del><ins>+#if defined(ANGLE_ENABLE_D3D9)
+ if (displayId != EGL_D3D11_ONLY_DISPLAY_ANGLE)
</ins><span class="cx"> {
</span><del>- renderer = new rx::Renderer11(display, hDc);
-
- if (renderer)
</del><ins>+ bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
+ rx::Renderer9 *renderer = new rx::Renderer9(display, hDc, softwareDevice);
+ if (renderer->initialize() == EGL_SUCCESS)
</ins><span class="cx"> {
</span><del>- status = renderer->initialize();
- }
-
- if (status == EGL_SUCCESS)
- {
</del><span class="cx"> return renderer;
</span><span class="cx"> }
</span><del>- else if (displayId == EGL_D3D11_ONLY_DISPLAY_ANGLE)
</del><ins>+ else
</ins><span class="cx"> {
</span><del>- return NULL;
</del><ins>+ SafeDelete(renderer);
</ins><span class="cx"> }
</span><del>-
- // Failed to create a D3D11 renderer, try creating a D3D9 renderer
- delete renderer;
</del><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><del>- bool softwareDevice = (displayId == EGL_SOFTWARE_DISPLAY_ANGLE);
- renderer = new rx::Renderer9(display, hDc, softwareDevice);
-
- if (renderer)
- {
- status = renderer->initialize();
- }
-
- if (status == EGL_SUCCESS)
- {
- return renderer;
- }
-
</del><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -222,4 +90,4 @@
</span><span class="cx"> delete renderer;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererRendererh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/Renderer.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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">@@ -14,7 +14,9 @@
</span><span class="cx"> #include "libGLESv2/angletypes.h"
</span><span class="cx">
</span><span class="cx"> #if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
</span><del>-#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
</del><ins>+// 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
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> const int versionWindowsVista = MAKEWORD(0x00, 0x06);
</span><span class="lines">@@ -39,38 +41,40 @@
</span><span class="cx"> {
</span><span class="cx"> class InfoLog;
</span><span class="cx"> class ProgramBinary;
</span><ins>+struct LinkedVarying;
</ins><span class="cx"> class VertexAttribute;
</span><span class="cx"> class Buffer;
</span><span class="cx"> class Texture;
</span><span class="cx"> class Framebuffer;
</span><ins>+struct VertexAttribCurrentValueData;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx"> class TextureStorageInterface2D;
</span><span class="cx"> class TextureStorageInterfaceCube;
</span><ins>+class TextureStorageInterface3D;
+class TextureStorageInterface2DArray;
</ins><span class="cx"> class VertexBuffer;
</span><span class="cx"> class IndexBuffer;
</span><span class="cx"> class QueryImpl;
</span><span class="cx"> class FenceImpl;
</span><span class="cx"> class BufferStorage;
</span><del>-class Blit;
</del><span class="cx"> struct TranslatedIndexData;
</span><span class="cx"> class ShaderExecutable;
</span><span class="cx"> class SwapChain;
</span><span class="cx"> class RenderTarget;
</span><span class="cx"> class Image;
</span><span class="cx"> class TextureStorage;
</span><ins>+class UniformStorage;
</ins><span class="cx">
</span><del>-typedef void * ShaderBlob;
-typedef void (*pCompileFunc)();
-
</del><span class="cx"> struct ConfigDesc
</span><span class="cx"> {
</span><span class="cx"> GLenum renderTargetFormat;
</span><span class="cx"> GLenum depthStencilFormat;
</span><span class="cx"> GLint multiSample;
</span><span class="cx"> bool fastConfig;
</span><ins>+ bool es3Capable;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct dx_VertexConstants
</span><span class="lines">@@ -93,12 +97,6 @@
</span><span class="cx"> SHADER_GEOMETRY
</span><span class="cx"> };
</span><span class="cx">
</span><del>-enum D3DWorkaroundType
-{
- ANGLE_D3D_WORKAROUND_NONE,
- ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER
-};
-
</del><span class="cx"> class Renderer
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="lines">@@ -115,11 +113,14 @@
</span><span class="cx">
</span><span class="cx"> virtual SwapChain *createSwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat) = 0;
</span><span class="cx">
</span><ins>+ virtual void generateSwizzle(gl::Texture *texture) = 0;
</ins><span class="cx"> virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler) = 0;
</span><span class="cx"> virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
</span><span class="cx">
</span><ins>+ virtual bool setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[]) = 0;
+
</ins><span class="cx"> virtual void setRasterizerState(const gl::RasterizerState &rasterState) = 0;
</span><del>- virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
</del><ins>+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
</ins><span class="cx"> unsigned int sampleMask) = 0;
</span><span class="cx"> virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
</span><span class="cx"> int stencilBackRef, bool frontFaceCCW) = 0;
</span><span class="lines">@@ -129,14 +130,17 @@
</span><span class="cx"> bool ignoreViewport) = 0;
</span><span class="cx">
</span><span class="cx"> virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer) = 0;
</span><del>- virtual void applyShaders(gl::ProgramBinary *programBinary) = 0;
- virtual void applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray) = 0;
</del><ins>+ virtual void applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[]) = 0;
+ virtual void applyUniforms(const gl::ProgramBinary &programBinary) = 0;
</ins><span class="cx"> virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0;
</span><del>- virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) = 0;
</del><ins>+ virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances) = 0;
</ins><span class="cx"> virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0;
</span><ins>+ virtual void applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[]) = 0;
</ins><span class="cx">
</span><del>- virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances) = 0;
- virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances) = 0;
</del><ins>+ virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive) = 0;
+ virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances) = 0;
</ins><span class="cx">
</span><span class="cx"> virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) = 0;
</span><span class="cx">
</span><span class="lines">@@ -154,14 +158,20 @@
</span><span class="cx"> virtual GUID getAdapterIdentifier() const = 0;
</span><span class="cx">
</span><span class="cx"> virtual bool getBGRATextureSupport() const = 0;
</span><del>- virtual bool getDXT1TextureSupport() = 0;
- virtual bool getDXT3TextureSupport() = 0;
- virtual bool getDXT5TextureSupport() = 0;
- virtual bool getEventQuerySupport() = 0;
- virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable) = 0;
- virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable) = 0;
- virtual bool getLuminanceTextureSupport() = 0;
- virtual bool getLuminanceAlphaTextureSupport() = 0;
</del><ins>+ virtual bool getDXT1TextureSupport() const = 0;
+ virtual bool getDXT3TextureSupport() const = 0;
+ virtual bool getDXT5TextureSupport() const = 0;
+ virtual bool getEventQuerySupport() const = 0;
+ virtual bool getFloat32TextureSupport() const = 0;
+ virtual bool getFloat32TextureFilteringSupport() const= 0;
+ virtual bool getFloat32TextureRenderingSupport() const= 0;
+ virtual bool getFloat16TextureSupport() const= 0;
+ virtual bool getFloat16TextureFilteringSupport() const= 0;
+ virtual bool getFloat16TextureRenderingSupport() const = 0;
+ virtual bool getRGB565TextureSupport() const = 0;
+ virtual bool getLuminanceTextureSupport() const = 0;
+ virtual bool getLuminanceAlphaTextureSupport() const = 0;
+ virtual bool getRGTextureSupport() const = 0;
</ins><span class="cx"> bool getVertexTextureSupport() const { return getMaxVertexTextureImageUnits() > 0; }
</span><span class="cx"> virtual unsigned int getMaxVertexTextureImageUnits() const = 0;
</span><span class="cx"> virtual unsigned int getMaxCombinedTextureImageUnits() const = 0;
</span><span class="lines">@@ -170,57 +180,86 @@
</span><span class="cx"> virtual unsigned int getMaxVertexUniformVectors() const = 0;
</span><span class="cx"> virtual unsigned int getMaxFragmentUniformVectors() const = 0;
</span><span class="cx"> virtual unsigned int getMaxVaryingVectors() const = 0;
</span><ins>+ virtual unsigned int getMaxVertexShaderUniformBuffers() const = 0;
+ virtual unsigned int getMaxFragmentShaderUniformBuffers() const = 0;
+ virtual unsigned int getReservedVertexUniformBuffers() const = 0;
+ virtual unsigned int getReservedFragmentUniformBuffers() const = 0;
+ virtual unsigned int getMaxTransformFeedbackBuffers() const = 0;
+ virtual unsigned int getMaxTransformFeedbackSeparateComponents() const = 0;
+ virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const = 0;
+ virtual unsigned int getMaxUniformBufferSize() const = 0;
</ins><span class="cx"> virtual bool getNonPower2TextureSupport() const = 0;
</span><span class="cx"> virtual bool getDepthTextureSupport() const = 0;
</span><span class="cx"> virtual bool getOcclusionQuerySupport() const = 0;
</span><span class="cx"> virtual bool getInstancingSupport() const = 0;
</span><span class="cx"> virtual bool getTextureFilterAnisotropySupport() const = 0;
</span><ins>+ virtual bool getPBOSupport() const = 0;
</ins><span class="cx"> virtual float getTextureMaxAnisotropy() const = 0;
</span><span class="cx"> virtual bool getShareHandleSupport() const = 0;
</span><span class="cx"> virtual bool getDerivativeInstructionSupport() const = 0;
</span><span class="cx"> virtual bool getPostSubBufferSupport() const = 0;
</span><ins>+ virtual int getMaxRecommendedElementsIndices() const = 0;
+ virtual int getMaxRecommendedElementsVertices() const = 0;
</ins><span class="cx">
</span><span class="cx"> virtual int getMajorShaderModel() const = 0;
</span><span class="cx"> virtual float getMaxPointSize() const = 0;
</span><span class="cx"> virtual int getMaxViewportDimension() const = 0;
</span><span class="cx"> virtual int getMaxTextureWidth() const = 0;
</span><span class="cx"> virtual int getMaxTextureHeight() const = 0;
</span><ins>+ virtual int getMaxTextureDepth() const = 0;
+ virtual int getMaxTextureArrayLayers() const = 0;
</ins><span class="cx"> virtual bool get32BitIndexSupport() const = 0;
</span><span class="cx"> virtual int getMinSwapInterval() const = 0;
</span><span class="cx"> virtual int getMaxSwapInterval() const = 0;
</span><span class="cx">
</span><span class="cx"> virtual GLsizei getMaxSupportedSamples() const = 0;
</span><ins>+ virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const = 0;
+ virtual GLsizei getNumSampleCounts(GLenum internalFormat) const = 0;
+ virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const = 0;
</ins><span class="cx">
</span><span class="cx"> virtual unsigned int getMaxRenderTargets() const = 0;
</span><span class="cx">
</span><span class="cx"> // Pixel operations
</span><span class="cx"> virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source) = 0;
</span><span class="cx"> virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source) = 0;
</span><ins>+ virtual bool copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source) = 0;
+ virtual bool copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source) = 0;
</ins><span class="cx">
</span><span class="cx"> virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
</span><span class="cx"> GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level) = 0;
</span><span class="cx"> virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
</span><span class="cx"> GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level) = 0;
</span><ins>+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level) = 0;
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level) = 0;
</ins><span class="cx">
</span><span class="cx"> virtual bool blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
</span><del>- bool blitRenderTarget, bool blitDepthStencil) = 0;
- virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels) = 0;
</del><ins>+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter) = 0;
+ virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels) = 0;
</ins><span class="cx">
</span><span class="cx"> // RenderTarget creation
</span><span class="cx"> virtual RenderTarget *createRenderTarget(SwapChain *swapChain, bool depth) = 0;
</span><del>- virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth) = 0;
</del><ins>+ virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples) = 0;
</ins><span class="cx">
</span><span class="cx"> // Shader operations
</span><del>- virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type) = 0;
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround) = 0;
</del><ins>+ virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers) = 0;
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround) = 0;
+ virtual UniformStorage *createUniformStorage(size_t storageSize) = 0;
</ins><span class="cx">
</span><span class="cx"> // Image operations
</span><span class="cx"> virtual Image *createImage() = 0;
</span><span class="cx"> virtual void generateMipmap(Image *dest, Image *source) = 0;
</span><span class="cx"> virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain) = 0;
</span><del>- virtual TextureStorage *createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height) = 0;
- virtual TextureStorage *createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size) = 0;
</del><ins>+ virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels) = 0;
+ virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels) = 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;
</ins><span class="cx">
</span><span class="cx"> // Buffer creation
</span><span class="cx"> virtual VertexBuffer *createVertexBuffer() = 0;
</span><span class="lines">@@ -231,19 +270,27 @@
</span><span class="cx"> virtual QueryImpl *createQuery(GLenum type) = 0;
</span><span class="cx"> virtual FenceImpl *createFence() = 0;
</span><span class="cx">
</span><ins>+ // Current GLES client version
+ void setCurrentClientVersion(int clientVersion) { mCurrentClientVersion = clientVersion; }
+ int getCurrentClientVersion() const { return mCurrentClientVersion; }
+
+ // Buffer-to-texture and Texture-to-buffer copies
+ virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const = 0;
+ virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea) = 0;
+
</ins><span class="cx"> virtual bool getLUID(LUID *adapterLuid) const = 0;
</span><ins>+ virtual GLenum getNativeTextureFormat(GLenum internalFormat) const = 0;
+ virtual rx::VertexConversionType getVertexConversionType(const gl::VertexFormat &vertexFormat) const = 0;
+ virtual GLenum getVertexComponentType(const gl::VertexFormat &vertexFormat) const = 0;
</ins><span class="cx">
</span><span class="cx"> protected:
</span><del>- bool initializeCompiler();
- ShaderBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags);
-
</del><span class="cx"> egl::Display *mDisplay;
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Renderer);
</span><span class="cx">
</span><del>- HMODULE mD3dCompilerModule;
- pCompileFunc mD3DCompileFunc;
</del><ins>+ int mCurrentClientVersion;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererShaderExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/ShaderExecutable.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/ShaderExecutable.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/ShaderExecutable.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> #define LIBGLESV2_RENDERER_SHADEREXECUTABLE_H_
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><ins>+#include "common/debug.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -46,6 +47,22 @@
</span><span class="cx"> const size_t mLength;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class UniformStorage
+{
+ public:
+ UniformStorage(size_t initialSize)
+ : mSize(initialSize)
+ {
+ }
+
+ virtual ~UniformStorage() {}
+
+ size_t size() const { return mSize; }
+
+ private:
+ size_t mSize;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererTextureStoragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -15,6 +15,7 @@
</span><span class="cx"> #include "libGLESv2/Texture.h"
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><ins>+#include "common/mathutil.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -36,7 +37,6 @@
</span><span class="cx"> return mInstance->isRenderTarget();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> bool TextureStorageInterface::isManaged() const
</span><span class="cx"> {
</span><span class="cx"> return mInstance->isManaged();
</span><span class="lines">@@ -52,36 +52,36 @@
</span><span class="cx"> return mCurrentTextureSerial++;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-int TextureStorageInterface::getLodOffset() const
</del><ins>+int TextureStorageInterface::getTopLevel() const
</ins><span class="cx"> {
</span><del>- return mInstance->getLodOffset();
</del><ins>+ return mInstance->getTopLevel();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-
-int TextureStorageInterface::levelCount()
</del><ins>+int TextureStorageInterface::getLevelCount() const
</ins><span class="cx"> {
</span><del>- return mInstance->levelCount();
</del><ins>+ return mInstance->getLevelCount();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain)
- : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
</del><ins>+TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain)
</ins><span class="cx"> {
</span><ins>+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(1);
+
</ins><span class="cx"> mInstance = renderer->createTextureStorage2D(swapchain);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
- : mRenderTargetSerial(gl::RenderbufferStorage::issueSerial())
</del><ins>+TextureStorageInterface2D::TextureStorageInterface2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
</ins><span class="cx"> {
</span><del>- mInstance = renderer->createTextureStorage2D(levels, internalformat, usage, forceRenderable, width, height);
</del><ins>+ mInstance = renderer->createTextureStorage2D(internalformat, renderTarget, width, height, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorageInterface2D::~TextureStorageInterface2D()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget *TextureStorageInterface2D::getRenderTarget() const
</del><ins>+RenderTarget *TextureStorageInterface2D::getRenderTarget(GLint level) const
</ins><span class="cx"> {
</span><del>- return mInstance->getRenderTarget();
</del><ins>+ return mInstance->getRenderTarget(level);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TextureStorageInterface2D::generateMipmap(int level)
</span><span class="lines">@@ -89,34 +89,92 @@
</span><span class="cx"> mInstance->generateMipmap(level);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int TextureStorageInterface2D::getRenderTargetSerial(GLenum target) const
</del><ins>+unsigned int TextureStorageInterface2D::getRenderTargetSerial(GLint level) const
</ins><span class="cx"> {
</span><del>- return mRenderTargetSerial;
</del><ins>+ return mFirstRenderTargetSerial + level;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorageInterfaceCube::TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
- : mFirstRenderTargetSerial(gl::RenderbufferStorage::issueCubeSerials())
</del><ins>+TextureStorageInterfaceCube::TextureStorageInterfaceCube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels)
</ins><span class="cx"> {
</span><del>- mInstance = renderer->createTextureStorageCube(levels, internalformat, usage, forceRenderable, size);
</del><ins>+ mInstance = renderer->createTextureStorageCube(internalformat, renderTarget, size, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount() * 6));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorageInterfaceCube::~TextureStorageInterfaceCube()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget *TextureStorageInterfaceCube::getRenderTarget(GLenum faceTarget) const
</del><ins>+RenderTarget *TextureStorageInterfaceCube::getRenderTarget(GLenum faceTarget, GLint level) const
</ins><span class="cx"> {
</span><del>- return mInstance->getRenderTarget(faceTarget);
</del><ins>+ return mInstance->getRenderTargetFace(faceTarget, level);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureStorageInterfaceCube::generateMipmap(int face, int level)
</del><ins>+void TextureStorageInterfaceCube::generateMipmap(int faceIndex, int level)
</ins><span class="cx"> {
</span><del>- mInstance->generateMipmap(face, level);
</del><ins>+ mInstance->generateMipmap(faceIndex, level);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target) const
</del><ins>+unsigned int TextureStorageInterfaceCube::getRenderTargetSerial(GLenum target, GLint level) const
</ins><span class="cx"> {
</span><del>- return mFirstRenderTargetSerial + gl::TextureCubeMap::faceIndex(target);
</del><ins>+ return mFirstRenderTargetSerial + (level * 6) + gl::TextureCubeMap::targetToIndex(target);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+TextureStorageInterface3D::TextureStorageInterface3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+
+ mInstance = renderer->createTextureStorage3D(internalformat, renderTarget, width, height, depth, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount() * depth));
+}
+
+TextureStorageInterface3D::~TextureStorageInterface3D()
+{
+}
+
+void TextureStorageInterface3D::generateMipmap(int level)
+{
+ mInstance->generateMipmap(level);
+}
+
+RenderTarget *TextureStorageInterface3D::getRenderTarget(GLint level) const
+{
+ return mInstance->getRenderTarget(level);
+}
+
+RenderTarget *TextureStorageInterface3D::getRenderTarget(GLint level, GLint layer) const
+{
+ return mInstance->getRenderTargetLayer(level, layer);
+}
+
+unsigned int TextureStorageInterface3D::getRenderTargetSerial(GLint level, GLint layer) const
+{
+ return mFirstRenderTargetSerial + static_cast<unsigned int>((layer * mInstance->getLevelCount()) + level);
+}
+
+TextureStorageInterface2DArray::TextureStorageInterface2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+ mInstance = renderer->createTextureStorage2DArray(internalformat, renderTarget, width, height, depth, levels);
+ mFirstRenderTargetSerial = gl::RenderbufferStorage::issueSerials(static_cast<GLuint>(mInstance->getLevelCount() * depth));
+}
+
+TextureStorageInterface2DArray::~TextureStorageInterface2DArray()
+{
+}
+
+void TextureStorageInterface2DArray::generateMipmap(int level)
+{
+ mInstance->generateMipmap(level);
+}
+
+RenderTarget *TextureStorageInterface2DArray::getRenderTarget(GLint level, GLint layer) const
+{
+ return mInstance->getRenderTargetLayer(level, layer);
+}
+
+unsigned int TextureStorageInterface2DArray::getRenderTargetSerial(GLint level, GLint layer) const
+{
+ return mFirstRenderTargetSerial + static_cast<unsigned int>((layer * mInstance->getLevelCount()) + level);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererTextureStorageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/TextureStorage.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2013 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">@@ -18,7 +18,6 @@
</span><span class="cx"> class Renderer;
</span><span class="cx"> class SwapChain;
</span><span class="cx"> class RenderTarget;
</span><del>-class Blit;
</del><span class="cx">
</span><span class="cx"> class TextureStorage
</span><span class="cx"> {
</span><span class="lines">@@ -26,13 +25,14 @@
</span><span class="cx"> TextureStorage() {};
</span><span class="cx"> virtual ~TextureStorage() {};
</span><span class="cx">
</span><del>- virtual int getLodOffset() const = 0;
</del><ins>+ virtual int getTopLevel() const = 0;
</ins><span class="cx"> virtual bool isRenderTarget() const = 0;
</span><span class="cx"> virtual bool isManaged() const = 0;
</span><del>- virtual int levelCount() = 0;
</del><ins>+ virtual int getLevelCount() const = 0;
</ins><span class="cx">
</span><del>- virtual RenderTarget *getRenderTarget() = 0;
- virtual RenderTarget *getRenderTarget(GLenum faceTarget) = 0;
</del><ins>+ virtual RenderTarget *getRenderTarget(int level) = 0;
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level) = 0;
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer) = 0;
</ins><span class="cx"> virtual void generateMipmap(int level) = 0;
</span><span class="cx"> virtual void generateMipmap(int face, int level) = 0;
</span><span class="cx">
</span><span class="lines">@@ -50,12 +50,11 @@
</span><span class="cx"> TextureStorage *getStorageInstance() { return mInstance; }
</span><span class="cx">
</span><span class="cx"> unsigned int getTextureSerial() const;
</span><del>- virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
</del><span class="cx">
</span><del>- virtual int getLodOffset() const;
</del><ins>+ virtual int getTopLevel() const;
</ins><span class="cx"> virtual bool isRenderTarget() const;
</span><span class="cx"> virtual bool isManaged() const;
</span><del>- virtual int levelCount();
</del><ins>+ virtual int getLevelCount() const;
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> TextureStorage *mInstance;
</span><span class="lines">@@ -73,38 +72,74 @@
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx"> TextureStorageInterface2D(Renderer *renderer, SwapChain *swapchain);
</span><del>- TextureStorageInterface2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
</del><ins>+ TextureStorageInterface2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
</ins><span class="cx"> virtual ~TextureStorageInterface2D();
</span><span class="cx">
</span><span class="cx"> void generateMipmap(int level);
</span><del>- RenderTarget *getRenderTarget() const;
</del><ins>+ RenderTarget *getRenderTarget(GLint level) const;
</ins><span class="cx">
</span><del>- virtual unsigned int getRenderTargetSerial(GLenum target) const;
</del><ins>+ unsigned int getRenderTargetSerial(GLint level) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface2D);
</span><span class="cx">
</span><del>- const unsigned int mRenderTargetSerial;
</del><ins>+ unsigned int mFirstRenderTargetSerial;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class TextureStorageInterfaceCube : public TextureStorageInterface
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- TextureStorageInterfaceCube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
</del><ins>+ TextureStorageInterfaceCube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels);
</ins><span class="cx"> virtual ~TextureStorageInterfaceCube();
</span><span class="cx">
</span><del>- void generateMipmap(int face, int level);
- RenderTarget *getRenderTarget(GLenum faceTarget) const;
</del><ins>+ void generateMipmap(int faceIndex, int level);
+ RenderTarget *getRenderTarget(GLenum faceTarget, GLint level) const;
</ins><span class="cx">
</span><del>- virtual unsigned int getRenderTargetSerial(GLenum target) const;
</del><ins>+ virtual unsigned int getRenderTargetSerial(GLenum target, GLint level) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureStorageInterfaceCube);
</span><span class="cx">
</span><del>- const unsigned int mFirstRenderTargetSerial;
</del><ins>+ unsigned int mFirstRenderTargetSerial;
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+class TextureStorageInterface3D : public TextureStorageInterface
+{
+ public:
+ TextureStorageInterface3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorageInterface3D();
+
+ void generateMipmap(int level);
+ RenderTarget *getRenderTarget(GLint level) const;
+ RenderTarget *getRenderTarget(GLint level, GLint layer) const;
+
+ virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface3D);
+
+ unsigned int mFirstRenderTargetSerial;
+};
+
+class TextureStorageInterface2DArray : public TextureStorageInterface
+{
+ public:
+ TextureStorageInterface2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorageInterface2DArray();
+
+ void generateMipmap(int level);
+ RenderTarget *getRenderTarget(GLint level, GLint layer) const;
+
+ virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorageInterface2DArray);
+
+ unsigned int mFirstRenderTargetSerial;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // LIBGLESV2_RENDERER_TEXTURESTORAGE_H_
</span><del>-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,7 +10,9 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/VertexBuffer.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><del>-#include "libGLESv2/Context.h"
</del><ins>+#include "libGLESv2/VertexAttribute.h"
+#include "libGLESv2/renderer/BufferStorage.h"
+#include "common/mathutil.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -87,8 +89,8 @@
</span><span class="cx"> return mVertexBuffer->discard();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset)
</del><ins>+bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset)
</ins><span class="cx"> {
</span><span class="cx"> unsigned int spaceRequired;
</span><span class="cx"> if (!mVertexBuffer->getSpaceRequired(attrib, count, instances, &spaceRequired))
</span><span class="lines">@@ -107,7 +109,7 @@
</span><span class="cx"> }
</span><span class="cx"> mReservedSpace = 0;
</span><span class="cx">
</span><del>- if (!mVertexBuffer->storeVertexAttributes(attrib, start, count, instances, mWritePosition))
</del><ins>+ if (!mVertexBuffer->storeVertexAttributes(attrib, currentValue, start, count, instances, mWritePosition))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -119,34 +121,9 @@
</span><span class="cx">
</span><span class="cx"> mWritePosition += spaceRequired;
</span><span class="cx">
</span><del>- return true;
-}
</del><ins>+ // Align to 16-byte boundary
+ mWritePosition = rx::roundUp(mWritePosition, 16u);
</ins><span class="cx">
</span><del>-bool VertexBufferInterface::storeRawData(const void* data, unsigned int size, unsigned int *outStreamOffset)
-{
- if (mWritePosition + size < mWritePosition)
- {
- return false;
- }
-
- if (!reserveSpace(mReservedSpace))
- {
- return false;
- }
- mReservedSpace = 0;
-
- if (!mVertexBuffer->storeRawData(data, size, mWritePosition))
- {
- return false;
- }
-
- if (outStreamOffset)
- {
- *outStreamOffset = mWritePosition;
- }
-
- mWritePosition += size;
-
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -165,18 +142,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mReservedSpace += requiredSpace;
</span><del>- return true;
-}
</del><span class="cx">
</span><del>-bool VertexBufferInterface::reserveRawDataSpace(unsigned int size)
-{
- // Protect against integer overflow
- if (mReservedSpace + size < mReservedSpace)
- {
- return false;
- }
</del><ins>+ // Align to 16-byte boundary
+ mReservedSpace = rx::roundUp(mReservedSpace, 16u);
</ins><span class="cx">
</span><del>- mReservedSpace += size;
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -185,7 +154,27 @@
</span><span class="cx"> return mVertexBuffer;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool VertexBufferInterface::directStoragePossible(const gl::VertexAttribute &attrib,
+ const gl::VertexAttribCurrentValueData &currentValue) const
+{
+ gl::Buffer *buffer = attrib.mBoundBuffer.get();
+ BufferStorage *storage = buffer ? buffer->getStorage() : NULL;
+ gl::VertexFormat vertexFormat(attrib, currentValue.Type);
</ins><span class="cx">
</span><ins>+ // 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)
+ unsigned int outputElementSize;
+ getVertexBuffer()->getSpaceRequired(attrib, 1, 0, &outputElementSize);
+ size_t alignment = std::min(static_cast<size_t>(outputElementSize), 4u);
+
+ bool isAligned = (static_cast<size_t>(attrib.stride()) % alignment == 0) &&
+ (static_cast<size_t>(attrib.mOffset) % alignment == 0);
+ bool requiresConversion = (mRenderer->getVertexConversionType(vertexFormat) & VERTEX_CONVERT_CPU) > 0;
+
+ return storage && storage->supportsDirectBinding() && !requiresConversion && isAligned;
+}
+
</ins><span class="cx"> StreamingVertexBufferInterface::StreamingVertexBufferInterface(rx::Renderer *renderer, std::size_t initialSize) : VertexBufferInterface(renderer, true)
</span><span class="cx"> {
</span><span class="cx"> setBufferSize(initialSize);
</span><span class="lines">@@ -231,7 +220,8 @@
</span><span class="cx"> if (mCache[element].type == attribute.mType &&
</span><span class="cx"> mCache[element].size == attribute.mSize &&
</span><span class="cx"> mCache[element].stride == attribute.stride() &&
</span><del>- mCache[element].normalized == attribute.mNormalized)
</del><ins>+ mCache[element].normalized == attribute.mNormalized &&
+ mCache[element].pureInteger == attribute.mPureInteger)
</ins><span class="cx"> {
</span><span class="cx"> if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
</span><span class="cx"> {
</span><span class="lines">@@ -266,14 +256,14 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool StaticVertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset)
</del><ins>+bool StaticVertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset)
</ins><span class="cx"> {
</span><span class="cx"> unsigned int streamOffset;
</span><del>- if (VertexBufferInterface::storeVertexAttributes(attrib, start, count, instances, &streamOffset))
</del><ins>+ if (VertexBufferInterface::storeVertexAttributes(attrib, currentValue, start, count, instances, &streamOffset))
</ins><span class="cx"> {
</span><span class="cx"> int attributeOffset = attrib.mOffset % attrib.stride();
</span><del>- VertexElement element = { attrib.mType, attrib.mSize, attrib.stride(), attrib.mNormalized, attributeOffset, streamOffset };
</del><ins>+ VertexElement element = { attrib.mType, attrib.mSize, attrib.stride(), attrib.mNormalized, attrib.mPureInteger, attributeOffset, streamOffset };
</ins><span class="cx"> mCache.push_back(element);
</span><span class="cx">
</span><span class="cx"> if (outStreamOffset)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexBuffer.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -15,6 +15,7 @@
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx"> class VertexAttribute;
</span><ins>+struct VertexAttribCurrentValueData;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="lines">@@ -29,15 +30,11 @@
</span><span class="cx">
</span><span class="cx"> virtual bool initialize(unsigned int size, bool dynamicUsage) = 0;
</span><span class="cx">
</span><del>- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count,
- GLsizei instances, unsigned int offset) = 0;
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset) = 0;
-
</del><ins>+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset) = 0;
</ins><span class="cx"> virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
</span><span class="cx"> unsigned int *outSpaceRequired) const = 0;
</span><span class="cx">
</span><del>- virtual bool requiresConversion(const gl::VertexAttribute &attrib) const = 0;
-
</del><span class="cx"> virtual unsigned int getBufferSize() const = 0;
</span><span class="cx"> virtual bool setBufferSize(unsigned int size) = 0;
</span><span class="cx"> virtual bool discard() = 0;
</span><span class="lines">@@ -61,16 +58,17 @@
</span><span class="cx"> virtual ~VertexBufferInterface();
</span><span class="cx">
</span><span class="cx"> bool reserveVertexSpace(const gl::VertexAttribute &attribute, GLsizei count, GLsizei instances);
</span><del>- bool reserveRawDataSpace(unsigned int size);
</del><span class="cx">
</span><span class="cx"> unsigned int getBufferSize() const;
</span><span class="cx">
</span><span class="cx"> unsigned int getSerial() const;
</span><span class="cx">
</span><del>- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset);
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int *outStreamOffset);
</del><ins>+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset);
</ins><span class="cx">
</span><ins>+ bool directStoragePossible(const gl::VertexAttribute &attrib,
+ const gl::VertexAttribCurrentValueData &currentValue) const;
+
</ins><span class="cx"> VertexBuffer* getVertexBuffer() const;
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="lines">@@ -111,10 +109,10 @@
</span><span class="cx"> explicit StaticVertexBufferInterface(rx::Renderer *renderer);
</span><span class="cx"> ~StaticVertexBufferInterface();
</span><span class="cx">
</span><del>- bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int *outStreamOffset);
</del><ins>+ bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset);
</ins><span class="cx">
</span><del>- bool lookupAttribute(const gl::VertexAttribute &attribute, unsigned int* outStreamOffset);
</del><ins>+ bool lookupAttribute(const gl::VertexAttribute &attribute, unsigned int* outStreamFffset);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> bool reserveSpace(unsigned int size);
</span><span class="lines">@@ -126,6 +124,7 @@
</span><span class="cx"> GLint size;
</span><span class="cx"> GLsizei stride;
</span><span class="cx"> bool normalized;
</span><ins>+ bool pureInteger;
</ins><span class="cx"> int attributeOffset;
</span><span class="cx">
</span><span class="cx"> unsigned int streamOffset;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexDataManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,8 +13,9 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx"> #include "libGLESv2/ProgramBinary.h"
</span><del>-#include "libGLESv2/Context.h"
</del><ins>+#include "libGLESv2/VertexAttribute.h"
</ins><span class="cx"> #include "libGLESv2/renderer/VertexBuffer.h"
</span><ins>+#include "libGLESv2/renderer/Renderer.h"
</ins><span class="cx">
</span><span class="cx"> namespace
</span><span class="cx"> {
</span><span class="lines">@@ -26,7 +27,7 @@
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><del>-static int elementsInBuffer(const gl::VertexAttribute &attribute, unsigned int size)
</del><ins>+static int ElementsInBuffer(const gl::VertexAttribute &attribute, unsigned int size)
</ins><span class="cx"> {
</span><span class="cx"> // Size cannot be larger than a GLsizei
</span><span class="cx"> if (size > static_cast<unsigned int>(std::numeric_limits<int>::max()))
</span><span class="lines">@@ -56,10 +57,11 @@
</span><span class="cx"> {
</span><span class="cx"> for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
</span><span class="cx"> {
</span><del>- mCurrentValue[i][0] = std::numeric_limits<float>::quiet_NaN();
- mCurrentValue[i][1] = std::numeric_limits<float>::quiet_NaN();
- mCurrentValue[i][2] = std::numeric_limits<float>::quiet_NaN();
- mCurrentValue[i][3] = std::numeric_limits<float>::quiet_NaN();
</del><ins>+ mCurrentValue[i].FloatValues[0] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].FloatValues[1] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].FloatValues[2] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].FloatValues[3] = std::numeric_limits<float>::quiet_NaN();
+ mCurrentValue[i].Type = GL_FLOAT;
</ins><span class="cx"> mCurrentValueBuffer[i] = NULL;
</span><span class="cx"> mCurrentValueOffsets[i] = 0;
</span><span class="cx"> }
</span><span class="lines">@@ -82,18 +84,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool directStoragePossible(VertexBufferInterface* vb, const gl::VertexAttribute& attrib)
</del><ins>+GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[], const gl::VertexAttribCurrentValueData currentValues[],
+ gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
</ins><span class="cx"> {
</span><del>- gl::Buffer *buffer = attrib.mBoundBuffer.get();
- BufferStorage *storage = buffer ? buffer->getStorage() : NULL;
-
- const bool isAligned = (attrib.stride() % 4 == 0) && (attrib.mOffset % 4 == 0);
-
- return storage && storage->supportsDirectBinding() && !vb->getVertexBuffer()->requiresConversion(attrib) && isAligned;
-}
-
-GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
-{
</del><span class="cx"> if (!mStreamingBuffer)
</span><span class="cx"> {
</span><span class="cx"> return GL_OUT_OF_MEMORY;
</span><span class="lines">@@ -113,7 +106,7 @@
</span><span class="cx"> StaticVertexBufferInterface *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
</span><span class="cx">
</span><span class="cx"> if (staticBuffer && staticBuffer->getBufferSize() > 0 && !staticBuffer->lookupAttribute(attribs[i], NULL) &&
</span><del>- !directStoragePossible(staticBuffer, attribs[i]))
</del><ins>+ !staticBuffer->directStoragePossible(attribs[i], currentValues[i]))
</ins><span class="cx"> {
</span><span class="cx"> buffer->invalidateStaticData();
</span><span class="cx"> }
</span><span class="lines">@@ -129,13 +122,13 @@
</span><span class="cx"> StaticVertexBufferInterface *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
</span><span class="cx"> VertexBufferInterface *vertexBuffer = staticBuffer ? staticBuffer : static_cast<VertexBufferInterface*>(mStreamingBuffer);
</span><span class="cx">
</span><del>- if (!directStoragePossible(vertexBuffer, attribs[i]))
</del><ins>+ if (!vertexBuffer->directStoragePossible(attribs[i], currentValues[i]))
</ins><span class="cx"> {
</span><span class="cx"> if (staticBuffer)
</span><span class="cx"> {
</span><span class="cx"> if (staticBuffer->getBufferSize() == 0)
</span><span class="cx"> {
</span><del>- int totalCount = elementsInBuffer(attribs[i], buffer->size());
</del><ins>+ int totalCount = ElementsInBuffer(attribs[i], buffer->size());
</ins><span class="cx"> if (!staticBuffer->reserveVertexSpace(attribs[i], totalCount, 0))
</span><span class="cx"> {
</span><span class="cx"> return GL_OUT_OF_MEMORY;
</span><span class="lines">@@ -146,9 +139,9 @@
</span><span class="cx"> {
</span><span class="cx"> int totalCount = StreamingBufferElementCount(attribs[i], count, instances);
</span><span class="cx">
</span><del>- // Undefined behaviour:
</del><ins>+ // [OpenGL ES 3.0.2] section 2.9.4 page 40:
</ins><span class="cx"> // We can return INVALID_OPERATION if our vertex attribute does not have enough backing data.
</span><del>- if (buffer && elementsInBuffer(attribs[i], buffer->size()) < totalCount)
</del><ins>+ if (buffer && ElementsInBuffer(attribs[i], buffer->size()) < totalCount)
</ins><span class="cx"> {
</span><span class="cx"> return GL_INVALID_OPERATION;
</span><span class="cx"> }
</span><span class="lines">@@ -182,7 +175,7 @@
</span><span class="cx"> VertexBufferInterface *vertexBuffer = staticBuffer ? staticBuffer : static_cast<VertexBufferInterface*>(mStreamingBuffer);
</span><span class="cx">
</span><span class="cx"> BufferStorage *storage = buffer ? buffer->getStorage() : NULL;
</span><del>- bool directStorage = directStoragePossible(vertexBuffer, attribs[i]);
</del><ins>+ bool directStorage = vertexBuffer->directStoragePossible(attribs[i], currentValues[i]);
</ins><span class="cx">
</span><span class="cx"> unsigned int streamOffset = 0;
</span><span class="cx"> unsigned int outputElementSize = 0;
</span><span class="lines">@@ -191,7 +184,6 @@
</span><span class="cx"> {
</span><span class="cx"> outputElementSize = attribs[i].stride();
</span><span class="cx"> streamOffset = attribs[i].mOffset + outputElementSize * start;
</span><del>- storage->markBufferUsage();
</del><span class="cx"> }
</span><span class="cx"> else if (staticBuffer)
</span><span class="cx"> {
</span><span class="lines">@@ -203,10 +195,11 @@
</span><span class="cx"> if (!staticBuffer->lookupAttribute(attribs[i], &streamOffset))
</span><span class="cx"> {
</span><span class="cx"> // Convert the entire buffer
</span><del>- int totalCount = elementsInBuffer(attribs[i], storage->getSize());
</del><ins>+ int totalCount = ElementsInBuffer(attribs[i], storage->getSize());
</ins><span class="cx"> int startIndex = attribs[i].mOffset / attribs[i].stride();
</span><span class="cx">
</span><del>- if (!staticBuffer->storeVertexAttributes(attribs[i], -startIndex, totalCount, 0, &streamOffset))
</del><ins>+ if (!staticBuffer->storeVertexAttributes(attribs[i], currentValues[i], -startIndex, totalCount,
+ 0, &streamOffset))
</ins><span class="cx"> {
</span><span class="cx"> return GL_OUT_OF_MEMORY;
</span><span class="cx"> }
</span><span class="lines">@@ -225,7 +218,8 @@
</span><span class="cx"> {
</span><span class="cx"> int totalCount = StreamingBufferElementCount(attribs[i], count, instances);
</span><span class="cx"> if (!mStreamingBuffer->getVertexBuffer()->getSpaceRequired(attribs[i], 1, 0, &outputElementSize) ||
</span><del>- !mStreamingBuffer->storeVertexAttributes(attribs[i], start, totalCount, instances, &streamOffset))
</del><ins>+ !mStreamingBuffer->storeVertexAttributes(attribs[i], currentValues[i], start, totalCount, instances,
+ &streamOffset))
</ins><span class="cx"> {
</span><span class="cx"> return GL_OUT_OF_MEMORY;
</span><span class="cx"> }
</span><span class="lines">@@ -237,6 +231,7 @@
</span><span class="cx"> translated[i].divisor = attribs[i].mDivisor;
</span><span class="cx">
</span><span class="cx"> translated[i].attribute = &attribs[i];
</span><ins>+ translated[i].currentValueType = currentValues[i].Type;
</ins><span class="cx"> translated[i].stride = outputElementSize;
</span><span class="cx"> translated[i].offset = streamOffset;
</span><span class="cx"> }
</span><span class="lines">@@ -249,27 +244,20 @@
</span><span class="cx">
</span><span class="cx"> StreamingVertexBufferInterface *buffer = mCurrentValueBuffer[i];
</span><span class="cx">
</span><del>- if (mCurrentValue[i][0] != attribs[i].mCurrentValue[0] ||
- mCurrentValue[i][1] != attribs[i].mCurrentValue[1] ||
- mCurrentValue[i][2] != attribs[i].mCurrentValue[2] ||
- mCurrentValue[i][3] != attribs[i].mCurrentValue[3])
</del><ins>+ if (mCurrentValue[i] != currentValues[i])
</ins><span class="cx"> {
</span><del>- unsigned int requiredSpace = sizeof(float) * 4;
- if (!buffer->reserveRawDataSpace(requiredSpace))
</del><ins>+ if (!buffer->reserveVertexSpace(attribs[i], 1, 0))
</ins><span class="cx"> {
</span><span class="cx"> return GL_OUT_OF_MEMORY;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> unsigned int streamOffset;
</span><del>- if (!buffer->storeRawData(attribs[i].mCurrentValue, requiredSpace, &streamOffset))
</del><ins>+ if (!buffer->storeVertexAttributes(attribs[i], currentValues[i], 0, 1, 0, &streamOffset))
</ins><span class="cx"> {
</span><span class="cx"> return GL_OUT_OF_MEMORY;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mCurrentValue[i][0] = attribs[i].mCurrentValue[0];
- mCurrentValue[i][1] = attribs[i].mCurrentValue[1];
- mCurrentValue[i][2] = attribs[i].mCurrentValue[2];
- mCurrentValue[i][3] = attribs[i].mCurrentValue[3];
</del><ins>+ mCurrentValue[i] = currentValues[i];
</ins><span class="cx"> mCurrentValueOffsets[i] = streamOffset;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -279,6 +267,7 @@
</span><span class="cx"> translated[i].divisor = 0;
</span><span class="cx">
</span><span class="cx"> translated[i].attribute = &attribs[i];
</span><ins>+ translated[i].currentValueType = currentValues[i].Type;
</ins><span class="cx"> translated[i].stride = 0;
</span><span class="cx"> translated[i].offset = mCurrentValueOffsets[i];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererVertexDataManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/VertexDataManager.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -11,12 +11,14 @@
</span><span class="cx"> #define LIBGLESV2_RENDERER_VERTEXDATAMANAGER_H_
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/Constants.h"
</span><ins>+#include "libGLESv2/VertexAttribute.h"
</ins><span class="cx"> #include "common/angleutils.h"
</span><span class="cx">
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx"> class VertexAttribute;
</span><span class="cx"> class ProgramBinary;
</span><ins>+struct VertexAttribCurrentValueData;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="lines">@@ -31,6 +33,7 @@
</span><span class="cx"> bool active;
</span><span class="cx">
</span><span class="cx"> const gl::VertexAttribute *attribute;
</span><ins>+ GLenum currentValueType;
</ins><span class="cx"> unsigned int offset;
</span><span class="cx"> unsigned int stride; // 0 means not to advance the read pointer at all
</span><span class="cx">
</span><span class="lines">@@ -46,7 +49,8 @@
</span><span class="cx"> VertexDataManager(rx::Renderer *renderer);
</span><span class="cx"> virtual ~VertexDataManager();
</span><span class="cx">
</span><del>- GLenum prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
</del><ins>+ GLenum prepareVertexData(const gl::VertexAttribute attribs[], const gl::VertexAttribCurrentValueData currentValues[],
+ gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
</span><span class="lines">@@ -55,7 +59,8 @@
</span><span class="cx">
</span><span class="cx"> StreamingVertexBufferInterface *mStreamingBuffer;
</span><span class="cx">
</span><del>- float mCurrentValue[gl::MAX_VERTEX_ATTRIBS][4];
</del><ins>+ gl::VertexAttribCurrentValueData mCurrentValue[gl::MAX_VERTEX_ATTRIBS];
+
</ins><span class="cx"> StreamingVertexBufferInterface *mCurrentValueBuffer[gl::MAX_VERTEX_ATTRIBS];
</span><span class="cx"> std::size_t mCurrentValueOffsets[gl::MAX_VERTEX_ATTRIBS];
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2renderercopyimagecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+#include "precompiled.h"
+//
+// 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 "libGLESv2/renderer/copyImage.h"
+
+namespace rx
+{
+
+void CopyBGRAUByteToRGBAUByte(const void *source, void *dest)
+{
+ unsigned int argb = *(unsigned int*)source;
+ *(unsigned int*)dest = (argb & 0xFF00FF00) | // Keep alpha and green
+ (argb & 0x00FF0000) >> 16 | // Move red to blue
+ (argb & 0x000000FF) << 16; // Move blue to red
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2renderercopyimageh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyimage.h        2014-04-30 22:57:08 UTC (rev 168055)
</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.
+//
+
+// copyimage.h: Defines image copying functions
+
+#ifndef LIBGLESV2_RENDERER_COPYIMAGE_H_
+#define LIBGLESV2_RENDERER_COPYIMAGE_H_
+
+#include "common/mathutil.h"
+#include "libGLESv2/angletypes.h"
+
+namespace rx
+{
+
+template <typename sourceType, typename colorDataType>
+void ReadColor(const void *source, void *dest)
+{
+ sourceType::readColor(reinterpret_cast<gl::Color<colorDataType>*>(dest), reinterpret_cast<const sourceType*>(source));
+}
+
+template <typename destType, typename colorDataType>
+void WriteColor(const void *source, void *dest)
+{
+ destType::writeColor(reinterpret_cast<destType*>(dest), reinterpret_cast<const gl::Color<colorDataType>*>(source));
+}
+
+template <typename sourceType, typename destType, typename colorDataType>
+void CopyPixel(const void *source, void *dest)
+{
+ colorType temp;
+ ReadColor<sourceType, colorDataType>(source, &temp);
+ WriteColor<destType, colorDataType>(&temp, dest);
+}
+
+void CopyBGRAUByteToRGBAUByte(const void *source, void *dest);
+
+}
+
+#endif // LIBGLESV2_RENDERER_COPYIMAGE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2renderercopyvertexh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyvertex.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyvertex.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/copyvertex.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,309 @@
</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.
+//
+
+// copyvertex.h: Defines vertex buffer copying and conversion functions
+
+#ifndef LIBGLESV2_RENDERER_COPYVERTEX_H_
+#define LIBGLESV2_RENDERER_COPYVERTEX_H_
+
+#include "common/mathutil.h"
+
+// 'widenDefaultValueBits' gives the default value for the alpha channel (4th component)
+// the sentinel value 0 means we do not want to widen the input or add an alpha channel
+template <typename T, unsigned int componentCount, unsigned int widenDefaultValueBits>
+inline void copyVertexData(const void *input, size_t stride, size_t count, void *output)
+{
+ const unsigned int attribSize = sizeof(T) * componentCount;
+ const T defaultValue = gl::bitCast<T>(widenDefaultValueBits);
+ const bool widen = (widenDefaultValueBits != 0);
+
+ if (attribSize == stride && !widen)
+ {
+ memcpy(output, input, count * attribSize);
+ }
+ else
+ {
+ unsigned int outputStride = widen ? 4 : componentCount;
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + i * stride);
+ T *offsetOutput = reinterpret_cast<T*>(output) + i * outputStride;
+
+ for (unsigned int j = 0; j < componentCount; j++)
+ {
+ offsetOutput[j] = offsetInput[j];
+ }
+
+ if (widen)
+ {
+ offsetOutput[3] = defaultValue;
+ }
+ }
+ }
+}
+
+template <unsigned int componentCount>
+inline void copyFixedVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ static const float divisor = 1.0f / (1 << 16);
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const GLfixed* offsetInput = reinterpret_cast<const GLfixed*>(reinterpret_cast<const char*>(input) + stride * i);
+ float* offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
+
+ for (unsigned int j = 0; j < componentCount; j++)
+ {
+ offsetOutput[j] = static_cast<float>(offsetInput[j]) * divisor;
+ }
+ }
+}
+
+template <typename T, unsigned int componentCount, bool normalized>
+inline void copyToFloatVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ typedef std::numeric_limits<T> NL;
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + stride * i);
+ float *offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
+
+ for (unsigned int j = 0; j < componentCount; j++)
+ {
+ if (normalized)
+ {
+ if (NL::is_signed)
+ {
+ const float divisor = 1.0f / (2 * static_cast<float>(NL::max()) + 1);
+ offsetOutput[j] = (2 * static_cast<float>(offsetInput[j]) + 1) * divisor;
+ }
+ else
+ {
+ offsetOutput[j] = static_cast<float>(offsetInput[j]) / NL::max();
+ }
+ }
+ else
+ {
+ offsetOutput[j] = static_cast<float>(offsetInput[j]);
+ }
+ }
+ }
+}
+
+inline void copyPackedUnsignedVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ const unsigned int attribSize = 4;
+
+ if (attribSize == stride)
+ {
+ memcpy(output, input, count * attribSize);
+ }
+ else
+ {
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const GLuint *offsetInput = reinterpret_cast<const GLuint*>(reinterpret_cast<const char*>(input) + (i * stride));
+ GLuint *offsetOutput = reinterpret_cast<GLuint*>(output) + (i * attribSize);
+
+ offsetOutput[i] = offsetInput[i];
+ }
+ }
+}
+
+template <bool isSigned, bool normalized, bool toFloat>
+static inline void copyPackedRGB(unsigned int data, void *output)
+{
+ const unsigned int rgbSignMask = 0x200; // 1 set at the 9 bit
+ const unsigned int negativeMask = 0xFFFFFC00; // All bits from 10 to 31 set to 1
+
+ if (toFloat)
+ {
+ GLfloat *floatOutput = reinterpret_cast<GLfloat*>(output);
+ if (isSigned)
+ {
+ GLfloat finalValue = 0;
+ if (data & rgbSignMask)
+ {
+ int negativeNumber = data | negativeMask;
+ finalValue = static_cast<GLfloat>(negativeNumber);
+ }
+ else
+ {
+ finalValue = static_cast<GLfloat>(data);
+ }
+
+ if (normalized)
+ {
+ const int maxValue = 0x1FF; // 1 set in bits 0 through 8
+ const int 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 < minValue)
+ {
+ finalValue = minValue;
+ }
+
+ const int halfRange = (maxValue - minValue) >> 1;
+ *floatOutput = ((finalValue - minValue) / halfRange) - 1.0f;
+ }
+ else
+ {
+ *floatOutput = finalValue;
+ }
+ }
+ else
+ {
+ if (normalized)
+ {
+ const unsigned int maxValue = 0x3FF; // 1 set in bits 0 through 9
+ *floatOutput = static_cast<GLfloat>(data) / static_cast<GLfloat>(maxValue);
+ }
+ else
+ {
+ *floatOutput = static_cast<GLfloat>(data);
+ }
+ }
+ }
+ else
+ {
+ if (isSigned)
+ {
+ GLshort *intOutput = reinterpret_cast<GLshort*>(output);
+
+ if (data & rgbSignMask)
+ {
+ *intOutput = data | negativeMask;
+ }
+ else
+ {
+ *intOutput = data;
+ }
+ }
+ else
+ {
+ GLushort *uintOutput = reinterpret_cast<GLushort*>(output);
+ *uintOutput = data;
+ }
+ }
+}
+
+template <bool isSigned, bool normalized, bool toFloat>
+inline void copyPackedAlpha(unsigned int data, void *output)
+{
+ if (toFloat)
+ {
+ GLfloat *floatOutput = reinterpret_cast<GLfloat*>(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<GLshort*>(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<GLushort*>(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 <bool isSigned, bool normalized, bool toFloat>
+inline void copyPackedVertexData(const void* input, size_t stride, size_t count, void* output)
+{
+ const unsigned int outputComponentSize = toFloat ? 4 : 2;
+ const unsigned int componentCount = 4;
+
+ const unsigned int rgbMask = 0x3FF; // 1 set in bits 0 through 9
+ const unsigned int redShift = 0; // red is bits 0 through 9
+ const unsigned int greenShift = 10; // green is bits 10 through 19
+ const unsigned int blueShift = 20; // blue is bits 20 through 29
+
+ const unsigned int alphaMask = 0x3; // 1 set in bits 0 and 1
+ const unsigned int alphaShift = 30; // Alpha is the 30 and 31 bits
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ GLuint packedValue = *reinterpret_cast<const GLuint*>(reinterpret_cast<const char*>(input) + (i * stride));
+ GLbyte *offsetOutput = reinterpret_cast<GLbyte*>(output) + (i * outputComponentSize * componentCount);
+
+ copyPackedRGB<isSigned, normalized, toFloat>( (packedValue >> redShift) & rgbMask, offsetOutput + (0 * outputComponentSize));
+ copyPackedRGB<isSigned, normalized, toFloat>( (packedValue >> greenShift) & rgbMask, offsetOutput + (1 * outputComponentSize));
+ copyPackedRGB<isSigned, normalized, toFloat>( (packedValue >> blueShift) & rgbMask, offsetOutput + (2 * outputComponentSize));
+ copyPackedAlpha<isSigned, normalized, toFloat>((packedValue >> alphaShift) & alphaMask, offsetOutput + (3* outputComponentSize));
+ }
+}
+
+#endif // LIBGLESV2_RENDERER_COPYVERTEX_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3dHLSLCompilercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+#include "precompiled.h"
+#include "libGLESv2/renderer/d3d/HLSLCompiler.h"
+#include "libGLESv2/Program.h"
+#include "libGLESv2/main.h"
+
+#include "common/utilities.h"
+
+#include "third_party/trace_event/trace_event.h"
+
+namespace rx
+{
+
+HLSLCompiler::HLSLCompiler()
+ : mD3DCompilerModule(NULL),
+ mD3DCompileFunc(NULL)
+{
+}
+
+HLSLCompiler::~HLSLCompiler()
+{
+ release();
+}
+
+bool HLSLCompiler::initialize()
+{
+ TRACE_EVENT0("gpu", "initializeCompiler");
+#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
+ // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.
+ static TCHAR* d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;
+
+ for (size_t i = 0; i < ArraySize(d3dCompilerNames); ++i)
+ {
+ if (GetModuleHandleEx(0, d3dCompilerNames[i], &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("No D3D compiler module found - aborting!\n");
+ return false;
+ }
+
+ mD3DCompileFunc = reinterpret_cast<CompileFuncPtr>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));
+ ASSERT(mD3DCompileFunc);
+
+ return mD3DCompileFunc != NULL;
+}
+
+void HLSLCompiler::release()
+{
+ if (mD3DCompilerModule)
+ {
+ FreeLibrary(mD3DCompilerModule);
+ mD3DCompilerModule = NULL;
+ mD3DCompileFunc = NULL;
+ }
+}
+
+ShaderBlob *HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile,
+ unsigned int optimizationFlags, bool alternateFlags) const
+{
+ ASSERT(mD3DCompilerModule && mD3DCompileFunc);
+
+ if (!hlsl)
+ {
+ return NULL;
+ }
+
+ HRESULT result = S_OK;
+ UINT flags = 0;
+ std::string sourceText;
+ if (gl::perfActive())
+ {
+ flags |= D3DCOMPILE_DEBUG;
+
+#ifdef NDEBUG
+ flags |= optimizationFlags;
+#else
+ flags |= D3DCOMPILE_SKIP_OPTIMIZATION;
+#endif
+
+ std::string sourcePath = getTempPath();
+ sourceText = std::string("#line 2 \"") + sourcePath + std::string("\"\n\n") + std::string(hlsl);
+ writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
+ }
+ else
+ {
+ flags |= optimizationFlags;
+ sourceText = hlsl;
+ }
+
+ // 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.
+ const static UINT extraFlags[] =
+ {
+ 0,
+ D3DCOMPILE_AVOID_FLOW_CONTROL,
+ D3DCOMPILE_PREFER_FLOW_CONTROL
+ };
+
+ const static char * const extraFlagNames[] =
+ {
+ "default",
+ "avoid flow control",
+ "prefer flow control"
+ };
+
+ int attempts = alternateFlags ? ArraySize(extraFlags) : 1;
+ pD3DCompile compileFunc = reinterpret_cast<pD3DCompile>(mD3DCompileFunc);
+ for (int i = 0; i < attempts; ++i)
+ {
+ ID3DBlob *errorMessage = NULL;
+ ID3DBlob *binary = NULL;
+
+ result = compileFunc(hlsl, strlen(hlsl), gl::g_fakepath, NULL, NULL,
+ "main", profile, flags | extraFlags[i], 0, &binary, &errorMessage);
+ if (errorMessage)
+ {
+ const char *message = (const char*)errorMessage->GetBufferPointer();
+
+ infoLog.appendSanitized(message);
+ TRACE("\n%s", hlsl);
+ TRACE("\n%s", message);
+
+ SafeRelease(errorMessage);
+ }
+
+ if (SUCCEEDED(result))
+ {
+ return (ShaderBlob*)binary;
+ }
+ else
+ {
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, (ShaderBlob*)NULL);
+ }
+
+ infoLog.append("Warning: D3D shader compilation failed with ");
+ infoLog.append(extraFlagNames[i]);
+ infoLog.append(" flags.");
+ if (i + 1 < attempts)
+ {
+ infoLog.append(" Retrying with ");
+ infoLog.append(extraFlagNames[i + 1]);
+ infoLog.append(".\n");
+ }
+ }
+ }
+
+ return NULL;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3dHLSLCompilerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.h (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.h         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d/HLSLCompiler.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+#ifndef LIBGLESV2_RENDERER_HLSL_D3DCOMPILER_H_
+#define LIBGLESV2_RENDERER_HLSL_D3DCOMPILER_H_
+
+#include "common/angleutils.h"
+
+#include <windows.h>
+
+namespace gl
+{
+class InfoLog;
+}
+
+namespace rx
+{
+
+typedef void* ShaderBlob;
+typedef void(*CompileFuncPtr)();
+
+class HLSLCompiler
+{
+ public:
+ HLSLCompiler();
+ ~HLSLCompiler();
+
+ bool initialize();
+ void release();
+
+ ShaderBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile,
+ unsigned int optimizationFlags, bool alternateFlags) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(HLSLCompiler);
+
+ HMODULE mD3DCompilerModule;
+ CompileFuncPtr mD3DCompileFunc;
+};
+
+}
+
+#endif // LIBGLESV2_RENDERER_HLSL_D3DCOMPILER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11BufferStorage11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2013-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">@@ -10,38 +10,159 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/BufferStorage11.h"
</span><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Renderer11.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/formatutils11.h"
+#include "libGLESv2/Buffer.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><del>-BufferStorage11::BufferStorage11(Renderer11 *renderer)
</del><ins>+PackPixelsParams::PackPixelsParams()
+ : format(GL_NONE),
+ type(GL_NONE),
+ outputPitch(0),
+ packBuffer(NULL),
+ offset(0)
+{}
+
+PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn, GLenum formatIn, GLenum typeIn, GLuint outputPitchIn,
+ const gl::PixelPackState &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
</ins><span class="cx"> {
</span><del>- mRenderer = renderer;
</del><span class="cx">
</span><del>- mStagingBuffer = NULL;
- mStagingBufferSize = 0;
</del><ins>+D3D11_MAP GetD3DMapTypeFromBits(GLbitfield access)
+{
+ bool readBit = ((access & GL_MAP_READ_BIT) != 0);
+ bool writeBit = ((access & GL_MAP_WRITE_BIT) != 0);
</ins><span class="cx">
</span><del>- mSize = 0;
</del><ins>+ ASSERT(readBit || writeBit);
</ins><span class="cx">
</span><del>- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
</del><ins>+ // Note : we ignore the discard bit, because in D3D11, staging buffers
+ // don't accept the map-discard flag (discard only works for DYNAMIC usage)
</ins><span class="cx">
</span><del>- mReadUsageCount = 0;
- mWriteUsageCount = 0;
</del><ins>+ if (readBit && !writeBit)
+ {
+ return D3D11_MAP_READ;
+ }
+ else if (writeBit && !readBit)
+ {
+ return D3D11_MAP_WRITE;
+ }
+ else if (writeBit && readBit)
+ {
+ return D3D11_MAP_READ_WRITE;
+ }
+ else
+ {
+ UNREACHABLE();
+ return D3D11_MAP_READ;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-BufferStorage11::~BufferStorage11()
</del><ins>+}
+
+// Each instance of BufferStorageD3DBuffer11 is specialized for a class of D3D binding points
+// - vertex/transform feedback buffers
+// - index buffers
+// - pixel unpack buffers
+// - uniform buffers
+class BufferStorage11::TypedBufferStorage11
</ins><span class="cx"> {
</span><del>- SafeRelease(mStagingBuffer);
</del><ins>+ public:
+ virtual ~TypedBufferStorage11() {}
</ins><span class="cx">
</span><del>- if (mResolvedData)
- {
- free(mResolvedData);
- mResolvedData = NULL;
- }
</del><ins>+ DataRevision getDataRevision() const { return mRevision; }
+ BufferUsage getUsage() const { return mUsage; }
+ size_t getSize() const { return mBufferSize; }
</ins><span class="cx">
</span><del>- for (auto it = mDirectBuffers.begin(); it != mDirectBuffers.end(); it++)
</del><ins>+ void setDataRevision(DataRevision rev) { mRevision = rev; }
+
+ virtual bool copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset) = 0;
+ virtual void resize(size_t size, bool preserveData) = 0;
+
+ virtual void *map(GLbitfield access) = 0;
+ virtual void unmap() = 0;
+
+ protected:
+ TypedBufferStorage11(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 BufferStorage11::NativeBuffer11 : public BufferStorage11::TypedBufferStorage11
+{
+ public:
+ NativeBuffer11(Renderer11 *renderer, BufferUsage usage);
+ ~NativeBuffer11();
+
+ ID3D11Buffer *getNativeBuffer() const { return mNativeBuffer; }
+
+ virtual bool copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset);
+ virtual void resize(size_t size, bool preserveData);
+
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
+ private:
+ ID3D11Buffer *mNativeBuffer;
+
+ static void fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize);
+};
+
+// 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 BufferStorage11::PackStorage11 : public BufferStorage11::TypedBufferStorage11
+{
+ public:
+ PackStorage11(Renderer11 *renderer);
+ ~PackStorage11();
+
+ virtual bool copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset);
+ virtual void resize(size_t size, bool preserveData);
+
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
+ void packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &params);
+
+ private:
+ ID3D11Texture2D *mStagingTexture;
+ DXGI_FORMAT mTextureFormat;
+ gl::Extents mTextureSize;
+ unsigned char *mMemoryBuffer;
+ PackPixelsParams mPackParams;
+ bool mDataModified;
+};
+
+BufferStorage11::BufferStorage11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mMappedStorage(NULL),
+ mResolvedDataRevision(0),
+ mReadUsageCount(0),
+ mWriteUsageCount(0),
+ mSize(0)
+{
+}
+
+BufferStorage11::~BufferStorage11()
+{
+ for (auto it = mTypedBuffers.begin(); it != mTypedBuffers.end(); it++)
</ins><span class="cx"> {
</span><span class="cx"> SafeDelete(it->second);
</span><span class="cx"> }
</span><span class="lines">@@ -55,109 +176,55 @@
</span><span class="cx">
</span><span class="cx"> void *BufferStorage11::getData()
</span><span class="cx"> {
</span><del>- ASSERT(mStagingBuffer);
-
- if (!mResolvedDataValid)
</del><ins>+ NativeBuffer11 *stagingBuffer = getStagingBuffer();
+ if (stagingBuffer->getDataRevision() > mResolvedDataRevision)
</ins><span class="cx"> {
</span><del>- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
-
- if (!mResolvedData || mResolvedDataSize < mStagingBufferSize)
</del><ins>+ if (stagingBuffer->getSize() > mResolvedData.size())
</ins><span class="cx"> {
</span><del>- free(mResolvedData);
- mResolvedData = malloc(mSize);
- mResolvedDataSize = mSize;
</del><ins>+ mResolvedData.resize(stagingBuffer->getSize());
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
</ins><span class="cx"> D3D11_MAPPED_SUBRESOURCE mappedResource;
</span><del>- result = context->Map(mStagingBuffer, 0, D3D11_MAP_READ, 0, &mappedResource);
</del><ins>+ HRESULT result = context->Map(stagingBuffer->getNativeBuffer(), 0, D3D11_MAP_READ, 0, &mappedResource);
</ins><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, (void*)NULL);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- memcpy(mResolvedData, mappedResource.pData, mSize);
</del><ins>+ memcpy(mResolvedData.data(), mappedResource.pData, stagingBuffer->getSize());
</ins><span class="cx">
</span><del>- context->Unmap(mStagingBuffer, 0);
</del><ins>+ context->Unmap(stagingBuffer->getNativeBuffer(), 0);
</ins><span class="cx">
</span><del>- mResolvedDataValid = true;
</del><ins>+ mResolvedDataRevision = stagingBuffer->getDataRevision();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- mReadUsageCount = 0;
-
- return mResolvedData;
</del><ins>+ return mResolvedData.data();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void BufferStorage11::setData(const void* data, unsigned int size, unsigned int offset)
</span><span class="cx"> {
</span><del>- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- HRESULT result;
</del><ins>+ size_t requiredSize = size + offset;
+ mWriteUsageCount = 0;
+ mSize = std::max(mSize, requiredSize);
</ins><span class="cx">
</span><del>- const unsigned int requiredStagingBufferSize = size + offset;
- const bool createStagingBuffer = !mStagingBuffer || mStagingBufferSize < requiredStagingBufferSize;
-
- if (createStagingBuffer)
</del><ins>+ if (data)
</ins><span class="cx"> {
</span><del>- D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = requiredStagingBufferSize;
- bufferDesc.Usage = D3D11_USAGE_STAGING;
- bufferDesc.BindFlags = 0;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
- bufferDesc.StructureByteStride = 0;
</del><ins>+ NativeBuffer11 *stagingBuffer = getStagingBuffer();
</ins><span class="cx">
</span><del>- HRESULT result;
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- ID3D11Buffer *newStagingBuffer;
-
- if (data && offset == 0)
</del><ins>+ // Explicitly resize the staging buffer, preserving data if the new data will not
+ // completely fill the buffer
+ if (stagingBuffer->getSize() < requiredSize)
</ins><span class="cx"> {
</span><del>- D3D11_SUBRESOURCE_DATA initialData;
- initialData.pSysMem = data;
- initialData.SysMemPitch = requiredStagingBufferSize;
- initialData.SysMemSlicePitch = 0;
-
- result = device->CreateBuffer(&bufferDesc, &initialData, &newStagingBuffer);
</del><ins>+ bool preserveData = (offset > 0);
+ stagingBuffer->resize(requiredSize, preserveData);
</ins><span class="cx"> }
</span><del>- else
- {
- result = device->CreateBuffer(&bufferDesc, NULL, &newStagingBuffer);
- }
</del><span class="cx">
</span><del>- if (FAILED(result))
- {
- mStagingBufferSize = 0;
- return gl::error(GL_OUT_OF_MEMORY);
- }
</del><ins>+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
</ins><span class="cx">
</span><del>- mStagingBufferSize = requiredStagingBufferSize;
-
- if (mStagingBuffer && offset > 0)
- {
- // If offset is greater than zero and the buffer is non-null, need to preserve the data from
- // the old buffer up to offset
- D3D11_BOX srcBox;
- srcBox.left = 0;
- srcBox.right = std::min(offset, requiredStagingBufferSize);
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
-
- context->CopySubresourceRegion(newStagingBuffer, 0, 0, 0, 0, mStagingBuffer, 0, &srcBox);
- }
-
- SafeRelease(mStagingBuffer);
- mStagingBuffer = newStagingBuffer;
- }
-
- if (data && (offset != 0 || !createStagingBuffer))
- {
</del><span class="cx"> D3D11_MAPPED_SUBRESOURCE mappedResource;
</span><del>- result = context->Map(mStagingBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource);
</del><ins>+ HRESULT result = context->Map(stagingBuffer->getNativeBuffer(), 0, D3D11_MAP_WRITE, 0, &mappedResource);
</ins><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="lines">@@ -166,47 +233,47 @@
</span><span class="cx"> unsigned char *offsetBufferPointer = reinterpret_cast<unsigned char *>(mappedResource.pData) + offset;
</span><span class="cx"> memcpy(offsetBufferPointer, data, size);
</span><span class="cx">
</span><del>- context->Unmap(mStagingBuffer, 0);
- }
</del><ins>+ context->Unmap(stagingBuffer->getNativeBuffer(), 0);
</ins><span class="cx">
</span><del>- for (auto it = mDirectBuffers.begin(); it != mDirectBuffers.end(); it++)
- {
- it->second->markDirty();
</del><ins>+ stagingBuffer->setDataRevision(stagingBuffer->getDataRevision() + 1);
</ins><span class="cx"> }
</span><del>-
- mSize = std::max(mSize, requiredStagingBufferSize);
- mWriteUsageCount = 0;
-
- mResolvedDataValid = false;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void BufferStorage11::copyData(BufferStorage* sourceStorage, unsigned int size,
</span><span class="cx"> unsigned int sourceOffset, unsigned int destOffset)
</span><span class="cx"> {
</span><del>- BufferStorage11* source = makeBufferStorage11(sourceStorage);
- if (source)
</del><ins>+ BufferStorage11* sourceStorage11 = makeBufferStorage11(sourceStorage);
+ if (sourceStorage11)
</ins><span class="cx"> {
</span><del>- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
</del><ins>+ TypedBufferStorage11 *dest = getLatestStorage();
+ if (!dest)
+ {
+ dest = getStagingBuffer();
+ }
</ins><span class="cx">
</span><del>- D3D11_BOX srcBox;
- srcBox.left = sourceOffset;
- srcBox.right = sourceOffset + size;
- srcBox.top = 0;
- srcBox.bottom = 1;
- srcBox.front = 0;
- srcBox.back = 1;
</del><ins>+ TypedBufferStorage11 *source = sourceStorage11->getLatestStorage();
+ if (source && dest)
+ {
+ dest->copyFromStorage(source, sourceOffset, size, destOffset);
+ dest->setDataRevision(dest->getDataRevision() + 1);
+ }
</ins><span class="cx">
</span><del>- ASSERT(mStagingBuffer && source->mStagingBuffer);
- context->CopySubresourceRegion(mStagingBuffer, 0, destOffset, 0, 0, source->mStagingBuffer, 0, &srcBox);
</del><ins>+ mSize = std::max(mSize, destOffset + size);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void BufferStorage11::clear()
</span><span class="cx"> {
</span><del>- mResolvedDataValid = false;
</del><span class="cx"> mSize = 0;
</span><ins>+ mResolvedDataRevision = 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void BufferStorage11::markTransformFeedbackUsage()
+{
+ TypedBufferStorage11 *transformFeedbackStorage = getStorage(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+ transformFeedbackStorage->setDataRevision(transformFeedbackStorage->getDataRevision() + 1);
+}
+
</ins><span class="cx"> unsigned int BufferStorage11::getSize() const
</span><span class="cx"> {
</span><span class="cx"> return mSize;
</span><span class="lines">@@ -224,12 +291,10 @@
</span><span class="cx">
</span><span class="cx"> const unsigned int usageLimit = 5;
</span><span class="cx">
</span><del>- if (mReadUsageCount > usageLimit && mResolvedData)
</del><ins>+ if (mReadUsageCount > usageLimit && mResolvedData.size() > 0)
</ins><span class="cx"> {
</span><del>- free(mResolvedData);
- mResolvedData = NULL;
- mResolvedDataSize = 0;
- mResolvedDataValid = false;
</del><ins>+ mResolvedData.resize(0);
+ mResolvedDataRevision = 0;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -237,118 +302,287 @@
</span><span class="cx"> {
</span><span class="cx"> markBufferUsage();
</span><span class="cx">
</span><del>- DirectBufferStorage11 *directBuffer = NULL;
</del><ins>+ TypedBufferStorage11 *typedBuffer = getStorage(usage);
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, typedBuffer));
</ins><span class="cx">
</span><del>- auto directBufferIt = mDirectBuffers.find(usage);
- if (directBufferIt != mDirectBuffers.end())
</del><ins>+ return static_cast<NativeBuffer11*>(typedBuffer)->getNativeBuffer();
+}
+
+ID3D11ShaderResourceView *BufferStorage11::getSRV(DXGI_FORMAT srvFormat)
+{
+ TypedBufferStorage11 *storage = getStorage(BUFFER_USAGE_PIXEL_UNPACK);
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, storage));
+ ID3D11Buffer *buffer = static_cast<NativeBuffer11*>(storage)->getNativeBuffer();
+
+ auto bufferSRVIt = mBufferResourceViews.find(srvFormat);
+
+ if (bufferSRVIt != mBufferResourceViews.end())
</ins><span class="cx"> {
</span><ins>+ if (bufferSRVIt->second.first == buffer)
+ {
+ return bufferSRVIt->second.second;
+ }
+ else
+ {
+ // The underlying buffer has changed since the SRV was created: recreate the SRV.
+ SafeRelease(bufferSRVIt->second.second);
+ }
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11ShaderResourceView *bufferSRV = NULL;
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC bufferSRVDesc;
+ bufferSRVDesc.Buffer.ElementOffset = 0;
+ bufferSRVDesc.Buffer.ElementWidth = mSize / d3d11::GetFormatPixelBytes(srvFormat);
+ bufferSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
+ bufferSRVDesc.Format = srvFormat;
+
+ HRESULT result = device->CreateShaderResourceView(buffer, &bufferSRVDesc, &bufferSRV);
+ ASSERT(SUCCEEDED(result));
+
+ mBufferResourceViews[srvFormat] = BufferSRVPair(buffer, bufferSRV);
+
+ return bufferSRV;
+}
+
+void BufferStorage11::packPixels(ID3D11Texture2D *srcTexture, UINT srcSubresource, const PackPixelsParams &params)
+{
+ PackStorage11 *packStorage = getPackStorage();
+
+ TypedBufferStorage11 *latestStorage = getLatestStorage();
+
+ packStorage->packPixels(srcTexture, srcSubresource, params);
+ packStorage->setDataRevision(latestStorage ? latestStorage->getDataRevision() + 1 : 1);
+}
+
+BufferStorage11::TypedBufferStorage11 *BufferStorage11::getStorage(BufferUsage usage)
+{
+ TypedBufferStorage11 *directBuffer = NULL;
+ auto directBufferIt = mTypedBuffers.find(usage);
+ if (directBufferIt != mTypedBuffers.end())
+ {
</ins><span class="cx"> directBuffer = directBufferIt->second;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (directBuffer)
</del><ins>+ if (!directBuffer)
</ins><span class="cx"> {
</span><del>- if (directBuffer->isDirty())
</del><ins>+ if (usage == BUFFER_USAGE_PIXEL_PACK)
</ins><span class="cx"> {
</span><del>- // if updateFromStagingBuffer returns true, the D3D buffer has been recreated
- // and we should update our serial
- if (directBuffer->updateFromStagingBuffer(mStagingBuffer, mSize, 0))
- {
- updateSerial();
- }
</del><ins>+ directBuffer = new PackStorage11(mRenderer);
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ // buffer is not allocated, create it
+ directBuffer = new NativeBuffer11(mRenderer, usage);
+ }
+
+ mTypedBuffers.insert(std::make_pair(usage, directBuffer));
</ins><span class="cx"> }
</span><del>- else
</del><ins>+
+ // resize buffer
+ if (directBuffer->getSize() < mSize)
</ins><span class="cx"> {
</span><del>- // buffer is not allocated, create it
- directBuffer = new DirectBufferStorage11(mRenderer, usage);
- directBuffer->updateFromStagingBuffer(mStagingBuffer, mSize, 0);
</del><ins>+ directBuffer->resize(mSize, true);
+ }
</ins><span class="cx">
</span><del>- mDirectBuffers.insert(std::make_pair(usage, directBuffer));
- updateSerial();
</del><ins>+ TypedBufferStorage11 *latestBuffer = getLatestStorage();
+ if (latestBuffer && latestBuffer->getDataRevision() > directBuffer->getDataRevision())
+ {
+ // if copyFromStorage returns true, the D3D buffer has been recreated
+ // and we should update our serial
+ if (directBuffer->copyFromStorage(latestBuffer, 0, latestBuffer->getSize(), 0))
+ {
+ updateSerial();
+ }
+ directBuffer->setDataRevision(latestBuffer->getDataRevision());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return directBuffer->getD3DBuffer();
</del><ins>+ return directBuffer;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-DirectBufferStorage11::DirectBufferStorage11(Renderer11 *renderer, BufferUsage usage)
</del><ins>+BufferStorage11::TypedBufferStorage11 *BufferStorage11::getLatestStorage() const
+{
+ // Even though we iterate over all the direct buffers, it is expected that only
+ // 1 or 2 will be present.
+ TypedBufferStorage11 *latestStorage = NULL;
+ DataRevision latestRevision = 0;
+ for (auto it = mTypedBuffers.begin(); it != mTypedBuffers.end(); it++)
+ {
+ TypedBufferStorage11 *storage = it->second;
+ if (storage->getDataRevision() > latestRevision)
+ {
+ latestStorage = storage;
+ latestRevision = storage->getDataRevision();
+ }
+ }
+
+ return latestStorage;
+}
+
+bool BufferStorage11::isMapped() const
+{
+ return mMappedStorage != NULL;
+}
+
+void *BufferStorage11::map(GLbitfield access)
+{
+ ASSERT(!mMappedStorage);
+
+ TypedBufferStorage11 *latestStorage = getLatestStorage();
+
+ if (latestStorage->getUsage() == BUFFER_USAGE_PIXEL_PACK ||
+ latestStorage->getUsage() == BUFFER_USAGE_STAGING)
+ {
+ mMappedStorage = latestStorage;
+ }
+ else
+ {
+ mMappedStorage = getStagingBuffer();
+ }
+
+ return mMappedStorage->map(access);
+}
+
+void BufferStorage11::unmap()
+{
+ ASSERT(mMappedStorage);
+ mMappedStorage->unmap();
+ mMappedStorage = NULL;
+}
+
+BufferStorage11::NativeBuffer11 *BufferStorage11::getStagingBuffer()
+{
+ TypedBufferStorage11 *stagingStorage = getStorage(BUFFER_USAGE_STAGING);
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, stagingStorage));
+ return static_cast<NativeBuffer11*>(stagingStorage);
+}
+
+BufferStorage11::PackStorage11 *BufferStorage11::getPackStorage()
+{
+ TypedBufferStorage11 *packStorage = getStorage(BUFFER_USAGE_PIXEL_PACK);
+ ASSERT(HAS_DYNAMIC_TYPE(PackStorage11*, packStorage));
+ return static_cast<PackStorage11*>(packStorage);
+}
+
+BufferStorage11::TypedBufferStorage11::TypedBufferStorage11(Renderer11 *renderer, BufferUsage usage)
</ins><span class="cx"> : mRenderer(renderer),
</span><span class="cx"> mUsage(usage),
</span><del>- mDirectBuffer(NULL),
- mBufferSize(0),
- mDirty(false)
</del><ins>+ mRevision(0),
+ mBufferSize(0)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-DirectBufferStorage11::~DirectBufferStorage11()
</del><ins>+BufferStorage11::NativeBuffer11::NativeBuffer11(Renderer11 *renderer, BufferUsage usage)
+ : TypedBufferStorage11(renderer, usage),
+ mNativeBuffer(NULL)
</ins><span class="cx"> {
</span><del>- SafeRelease(mDirectBuffer);
</del><span class="cx"> }
</span><span class="cx">
</span><del>-BufferUsage DirectBufferStorage11::getUsage() const
</del><ins>+BufferStorage11::NativeBuffer11::~NativeBuffer11()
</ins><span class="cx"> {
</span><del>- return mUsage;
</del><ins>+ SafeRelease(mNativeBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Returns true if it recreates the direct buffer
</span><del>-bool DirectBufferStorage11::updateFromStagingBuffer(ID3D11Buffer *stagingBuffer, size_t size, size_t offset)
</del><ins>+bool BufferStorage11::NativeBuffer11::copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset)
</ins><span class="cx"> {
</span><del>- ID3D11Device *device = mRenderer->getDevice();
</del><ins>+ if (source->getUsage() == BUFFER_USAGE_PIXEL_PACK)
+ {
+ UNIMPLEMENTED();
+ return false;
+ }
+
+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, source));
+
+ if (source->getUsage() == BUFFER_USAGE_PIXEL_PACK)
+ {
+ return false;
+ }
+
</ins><span class="cx"> ID3D11DeviceContext *context = mRenderer->getDeviceContext();
</span><span class="cx">
</span><del>- // unused for now
- ASSERT(offset == 0);
</del><ins>+ size_t requiredSize = sourceOffset + size;
+ bool createBuffer = !mNativeBuffer || mBufferSize < requiredSize;
</ins><span class="cx">
</span><del>- unsigned int requiredBufferSize = size + offset;
- bool createBuffer = !mDirectBuffer || mBufferSize < requiredBufferSize;
-
</del><span class="cx"> // (Re)initialize D3D buffer if needed
</span><span class="cx"> if (createBuffer)
</span><span class="cx"> {
</span><del>- D3D11_BUFFER_DESC bufferDesc;
- fillBufferDesc(&bufferDesc, mRenderer, mUsage, requiredBufferSize);
-
- ID3D11Buffer *newBuffer;
- HRESULT result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
-
- if (FAILED(result))
- {
- return gl::error(GL_OUT_OF_MEMORY, false);
- }
-
- // No longer need the old buffer
- SafeRelease(mDirectBuffer);
- mDirectBuffer = newBuffer;
-
- mBufferSize = bufferDesc.ByteWidth;
</del><ins>+ bool preserveData = (destOffset > 0);
+ resize(source->getSize(), preserveData);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- // Copy data via staging buffer
</del><span class="cx"> D3D11_BOX srcBox;
</span><del>- srcBox.left = 0;
- srcBox.right = size;
</del><ins>+ srcBox.left = sourceOffset;
+ srcBox.right = sourceOffset + size;
</ins><span class="cx"> srcBox.top = 0;
</span><span class="cx"> srcBox.bottom = 1;
</span><span class="cx"> srcBox.front = 0;
</span><span class="cx"> srcBox.back = 1;
</span><span class="cx">
</span><del>- context->CopySubresourceRegion(mDirectBuffer, 0, offset, 0, 0, stagingBuffer, 0, &srcBox);
</del><ins>+ ASSERT(HAS_DYNAMIC_TYPE(NativeBuffer11*, source));
+ ID3D11Buffer *sourceBuffer = static_cast<NativeBuffer11*>(source)->getNativeBuffer();
</ins><span class="cx">
</span><del>- mDirty = false;
</del><ins>+ context->CopySubresourceRegion(mNativeBuffer, 0, destOffset, 0, 0, sourceBuffer, 0, &srcBox);
</ins><span class="cx">
</span><span class="cx"> return createBuffer;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DirectBufferStorage11::fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize)
</del><ins>+void BufferStorage11::NativeBuffer11::resize(size_t size, bool preserveData)
</ins><span class="cx"> {
</span><ins>+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ D3D11_BUFFER_DESC bufferDesc;
+ fillBufferDesc(&bufferDesc, mRenderer, mUsage, size);
+
+ ID3D11Buffer *newBuffer;
+ HRESULT result = device->CreateBuffer(&bufferDesc, NULL, &newBuffer);
+
+ if (FAILED(result))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ if (mNativeBuffer && preserveData)
+ {
+ D3D11_BOX srcBox;
+ srcBox.left = 0;
+ srcBox.right = size;
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ context->CopySubresourceRegion(newBuffer, 0, 0, 0, 0, mNativeBuffer, 0, &srcBox);
+ }
+
+ // No longer need the old buffer
+ SafeRelease(mNativeBuffer);
+ mNativeBuffer = newBuffer;
+
+ mBufferSize = bufferDesc.ByteWidth;
+}
+
+void BufferStorage11::NativeBuffer11::fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer,
+ BufferUsage usage, unsigned int bufferSize)
+{
</ins><span class="cx"> bufferDesc->ByteWidth = bufferSize;
</span><span class="cx"> bufferDesc->MiscFlags = 0;
</span><span class="cx"> bufferDesc->StructureByteStride = 0;
</span><span class="cx">
</span><span class="cx"> switch (usage)
</span><span class="cx"> {
</span><del>- case BUFFER_USAGE_VERTEX:
</del><ins>+ case BUFFER_USAGE_STAGING:
+ bufferDesc->Usage = D3D11_USAGE_STAGING;
+ bufferDesc->BindFlags = 0;
+ bufferDesc->CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ break;
+
+ case BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK:
</ins><span class="cx"> bufferDesc->Usage = D3D11_USAGE_DEFAULT;
</span><del>- bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER;
</del><ins>+ bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_STREAM_OUTPUT;
</ins><span class="cx"> bufferDesc->CPUAccessFlags = 0;
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -358,9 +592,161 @@
</span><span class="cx"> bufferDesc->CPUAccessFlags = 0;
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case BUFFER_USAGE_PIXEL_UNPACK:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_UNIFORM:
+ bufferDesc->Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc->BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufferDesc->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->ByteWidth = roundUp(bufferDesc->ByteWidth, 16u);
+ bufferDesc->ByteWidth = std::min(bufferDesc->ByteWidth, renderer->getMaxUniformBufferSize());
+ break;
+
</ins><span class="cx"> default:
</span><span class="cx"> UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void *BufferStorage11::NativeBuffer11::map(GLbitfield access)
+{
+ ASSERT(mUsage == BUFFER_USAGE_STAGING);
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ D3D11_MAP d3dMapType = gl_d3d11::GetD3DMapTypeFromBits(access);
+ UINT d3dMapFlag = ((access & GL_MAP_UNSYNCHRONIZED_BIT) != 0 ? D3D11_MAP_FLAG_DO_NOT_WAIT : 0);
+
+ HRESULT result = context->Map(mNativeBuffer, 0, d3dMapType, d3dMapFlag, &mappedResource);
+ ASSERT(SUCCEEDED(result));
+
+ return mappedResource.pData;
</ins><span class="cx"> }
</span><ins>+
+void BufferStorage11::NativeBuffer11::unmap()
+{
+ ASSERT(mUsage == BUFFER_USAGE_STAGING);
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ context->Unmap(mNativeBuffer, 0);
+}
+
+BufferStorage11::PackStorage11::PackStorage11(Renderer11 *renderer)
+ : TypedBufferStorage11(renderer, BUFFER_USAGE_PIXEL_PACK),
+ mStagingTexture(NULL),
+ mTextureFormat(DXGI_FORMAT_UNKNOWN),
+ mMemoryBuffer(NULL),
+ mDataModified(false)
+{
+}
+
+BufferStorage11::PackStorage11::~PackStorage11()
+{
+ SafeRelease(mStagingTexture);
+ SafeDeleteArray(mMemoryBuffer);
+}
+
+bool BufferStorage11::PackStorage11::copyFromStorage(TypedBufferStorage11 *source, size_t sourceOffset,
+ size_t size, size_t destOffset)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+void BufferStorage11::PackStorage11::resize(size_t size, bool preserveData)
+{
+ UNIMPLEMENTED();
+}
+
+void *BufferStorage11::PackStorage11::map(GLbitfield access)
+{
+ ASSERT(!mMemoryBuffer);
+
+ // 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.
+
+ mMemoryBuffer = new unsigned char[mBufferSize];
+ mRenderer->packPixels(mStagingTexture, mPackParams, mMemoryBuffer);
+ mDataModified = (mDataModified || (access & GL_MAP_WRITE_BIT) != 0);
+
+ return mMemoryBuffer;
+}
+
+void BufferStorage11::PackStorage11::unmap()
+{
+ ASSERT(mMemoryBuffer);
+ SafeDeleteArray(mMemoryBuffer);
+}
+
+void BufferStorage11::PackStorage11::packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &params)
+{
+ mPackParams = params;
+ mBufferSize = mPackParams.outputPitch * mPackParams.area.height;
+
+ D3D11_TEXTURE2D_DESC textureDesc;
+ srcTexure->GetDesc(&textureDesc);
+
+ if (mStagingTexture != NULL &&
+ (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->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->CreateTexture2D(&stagingDesc, NULL, &mStagingTexture);
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ ID3D11Texture2D* srcTex = NULL;
+ if (textureDesc.SampleDesc.Count > 1)
+ {
+ UNIMPLEMENTED();
+ }
+
+ ID3D11DeviceContext *immediateContext = mRenderer->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->CopySubresourceRegion(mStagingTexture, 0, 0, 0, 0, srcTexure, srcSubresource, &srcBox);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11BufferStorage11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/BufferStorage11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2013-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">@@ -10,19 +10,40 @@
</span><span class="cx"> #define LIBGLESV2_RENDERER_BUFFERSTORAGE11_H_
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/BufferStorage.h"
</span><ins>+#include "libGLESv2/angletypes.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx"> class Renderer;
</span><span class="cx"> class Renderer11;
</span><del>-class DirectBufferStorage11;
</del><span class="cx">
</span><span class="cx"> enum BufferUsage
</span><span class="cx"> {
</span><del>- BUFFER_USAGE_VERTEX,
</del><ins>+ BUFFER_USAGE_STAGING,
+ BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK,
</ins><span class="cx"> BUFFER_USAGE_INDEX,
</span><ins>+ BUFFER_USAGE_PIXEL_UNPACK,
+ BUFFER_USAGE_PIXEL_PACK,
+ BUFFER_USAGE_UNIFORM,
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+struct PackPixelsParams
+{
+ PackPixelsParams();
+ PackPixelsParams(const gl::Rectangle &area, GLenum format, GLenum type, GLuint outputPitch,
+ const gl::PixelPackState &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;
+
</ins><span class="cx"> class BufferStorage11 : public BufferStorage
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="lines">@@ -36,55 +57,45 @@
</span><span class="cx"> virtual void copyData(BufferStorage* sourceStorage, unsigned int size,
</span><span class="cx"> unsigned int sourceOffset, unsigned int destOffset);
</span><span class="cx"> virtual void clear();
</span><ins>+ virtual void markTransformFeedbackUsage();
</ins><span class="cx"> virtual unsigned int getSize() const;
</span><span class="cx"> virtual bool supportsDirectBinding() const;
</span><span class="cx">
</span><span class="cx"> ID3D11Buffer *getBuffer(BufferUsage usage);
</span><ins>+ ID3D11ShaderResourceView *getSRV(DXGI_FORMAT srvFormat);
+ void packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &params);
</ins><span class="cx">
</span><ins>+ virtual bool isMapped() const;
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
</ins><span class="cx"> private:
</span><ins>+ class TypedBufferStorage11;
+ class NativeBuffer11;
+ class PackStorage11;
+
</ins><span class="cx"> Renderer11 *mRenderer;
</span><ins>+ TypedBufferStorage11 *mMappedStorage;
</ins><span class="cx">
</span><del>- ID3D11Buffer *mStagingBuffer;
- unsigned int mStagingBufferSize;
</del><ins>+ std::map<BufferUsage, TypedBufferStorage11*> mTypedBuffers;
</ins><span class="cx">
</span><del>- std::map<BufferUsage, DirectBufferStorage11*> mDirectBuffers;
</del><ins>+ typedef std::pair<ID3D11Buffer *, ID3D11ShaderResourceView *> BufferSRVPair;
+ std::map<DXGI_FORMAT, BufferSRVPair> mBufferResourceViews;
</ins><span class="cx">
</span><del>- unsigned int mSize;
</del><ins>+ std::vector<unsigned char> mResolvedData;
+ DataRevision mResolvedDataRevision;
</ins><span class="cx">
</span><del>- void *mResolvedData;
- unsigned int mResolvedDataSize;
- bool mResolvedDataValid;
-
</del><span class="cx"> unsigned int mReadUsageCount;
</span><span class="cx"> unsigned int mWriteUsageCount;
</span><span class="cx">
</span><ins>+ size_t mSize;
+
</ins><span class="cx"> void markBufferUsage();
</span><del>-};
</del><ins>+ NativeBuffer11 *getStagingBuffer();
+ PackStorage11 *getPackStorage();
</ins><span class="cx">
</span><del>-// Each instance of BufferStorageD3DBuffer11 is specialized for a class of D3D binding points
-// - vertex buffers
-// - index buffers
-class DirectBufferStorage11
-{
- public:
- DirectBufferStorage11(Renderer11 *renderer, BufferUsage usage);
- ~DirectBufferStorage11();
-
- BufferUsage getUsage() const;
- bool updateFromStagingBuffer(ID3D11Buffer *stagingBuffer, size_t size, size_t offset);
-
- ID3D11Buffer *getD3DBuffer() { return mDirectBuffer; }
- bool isDirty() const { return mDirty; }
- void markDirty() { mDirty = true; }
-
- private:
- Renderer11 *mRenderer;
- const BufferUsage mUsage;
- ID3D11Buffer *mDirectBuffer;
- size_t mBufferSize;
- bool mDirty;
-
- static void fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer *renderer, BufferUsage usage, unsigned int bufferSize);
</del><ins>+ TypedBufferStorage11 *getStorage(BufferUsage usage);
+ TypedBufferStorage11 *getLatestStorage() const;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Fence11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -22,21 +22,15 @@
</span><span class="cx">
</span><span class="cx"> Fence11::~Fence11()
</span><span class="cx"> {
</span><del>- if (mQuery)
- {
- mQuery->Release();
- mQuery = NULL;
- }
</del><ins>+ SafeRelease(mQuery);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-GLboolean Fence11::isFence()
</del><ins>+bool Fence11::isSet() const
</ins><span class="cx"> {
</span><del>- // GL_NV_fence spec:
- // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
</del><span class="cx"> return mQuery != NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence11::setFence(GLenum condition)
</del><ins>+void Fence11::set()
</ins><span class="cx"> {
</span><span class="cx"> if (!mQuery)
</span><span class="cx"> {
</span><span class="lines">@@ -51,84 +45,27 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mRenderer->getDeviceContext()->End(mQuery);
</span><del>-
- setCondition(condition);
- setStatus(GL_FALSE);
</del><span class="cx"> }
</span><span class="cx">
</span><del>-GLboolean Fence11::testFence()
</del><ins>+bool Fence11::test(bool flushCommandBuffer)
</ins><span class="cx"> {
</span><del>- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION, GL_TRUE);
- }
</del><ins>+ ASSERT(mQuery);
</ins><span class="cx">
</span><del>- HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, NULL, 0, 0);
</del><ins>+ UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH);
+ HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, NULL, 0, getDataFlags);
</ins><span class="cx">
</span><span class="cx"> if (mRenderer->isDeviceLost())
</span><span class="cx"> {
</span><del>- return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
</del><ins>+ return gl::error(GL_OUT_OF_MEMORY, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT(result == S_OK || result == S_FALSE);
</span><del>- setStatus(result == S_OK);
- return getStatus();
</del><ins>+ return (result == S_OK);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence11::finishFence()
</del><ins>+bool Fence11::hasError() const
</ins><span class="cx"> {
</span><del>- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- while (!testFence())
- {
- Sleep(0);
- }
</del><ins>+ return mRenderer->isDeviceLost();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence11::getFenceiv(GLenum pname, GLint *params)
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (pname)
- {
- case GL_FENCE_STATUS_NV:
- {
- // GL_NV_fence spec:
- // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
- // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
- if (getStatus())
- {
- params[0] = GL_TRUE;
- return;
- }
-
- HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, NULL, 0, D3D11_ASYNC_GETDATA_DONOTFLUSH);
-
- if (mRenderer->isDeviceLost())
- {
- params[0] = GL_TRUE;
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- setStatus(result == S_OK);
- params[0] = getStatus();
-
- break;
- }
- case GL_FENCE_CONDITION_NV:
- params[0] = getCondition();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- break;
- }
</del><span class="cx"> }
</span><del>-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Fence11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Fence11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -21,11 +21,10 @@
</span><span class="cx"> explicit Fence11(rx::Renderer11 *renderer);
</span><span class="cx"> virtual ~Fence11();
</span><span class="cx">
</span><del>- GLboolean isFence();
- void setFence(GLenum condition);
- GLboolean testFence();
- void finishFence();
- void getFenceiv(GLenum pname, GLint *params);
</del><ins>+ bool isSet() const;
+ void set();
+ bool test(bool flushCommandBuffer);
+ bool hasError() const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Fence11);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Image11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -15,9 +15,9 @@
</span><span class="cx"> #include "libGLESv2/Renderbuffer.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/main.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</span><del>-#include "libGLESv2/renderer/generatemip.h"
</del><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -31,10 +31,7 @@
</span><span class="cx">
</span><span class="cx"> Image11::~Image11()
</span><span class="cx"> {
</span><del>- if (mStagingTexture)
- {
- mStagingTexture->Release();
- }
</del><ins>+ SafeRelease(mStagingTexture);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Image11 *Image11::makeImage11(Image *img)
</span><span class="lines">@@ -43,125 +40,106 @@
</span><span class="cx"> return static_cast<rx::Image11*>(img);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Image11::generateMipmap(Image11 *dest, Image11 *src)
</del><ins>+void Image11::generateMipmap(GLuint clientVersion, Image11 *dest, Image11 *src)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(src->getDXGIFormat() == dest->getDXGIFormat());
</span><span class="cx"> ASSERT(src->getWidth() == 1 || src->getWidth() / 2 == dest->getWidth());
</span><span class="cx"> ASSERT(src->getHeight() == 1 || src->getHeight() / 2 == dest->getHeight());
</span><span class="cx">
</span><del>- D3D11_MAPPED_SUBRESOURCE destMapped, srcMapped;
- dest->map(D3D11_MAP_WRITE, &destMapped);
- src->map(D3D11_MAP_READ, &srcMapped);
</del><ins>+ MipGenerationFunction mipFunction = d3d11::GetMipGenerationFunction(src->getDXGIFormat());
+ ASSERT(mipFunction != NULL);
</ins><span class="cx">
</span><del>- const unsigned char *sourceData = reinterpret_cast<const unsigned char*>(srcMapped.pData);
- unsigned char *destData = reinterpret_cast<unsigned char*>(destMapped.pData);
</del><ins>+ D3D11_MAPPED_SUBRESOURCE destMapped;
+ HRESULT destMapResult = dest->map(D3D11_MAP_WRITE, &destMapped);
+ if (FAILED(destMapResult))
+ {
+ ERR("Failed to map destination image for mip map generation. HRESULT:0x%X", destMapResult);
+ return;
+ }
</ins><span class="cx">
</span><del>- if (sourceData && destData)
</del><ins>+ D3D11_MAPPED_SUBRESOURCE srcMapped;
+ HRESULT srcMapResult = src->map(D3D11_MAP_READ, &srcMapped);
+ if (FAILED(srcMapResult))
</ins><span class="cx"> {
</span><del>- switch (src->getDXGIFormat())
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- GenerateMip<R8G8B8A8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_A8_UNORM:
- GenerateMip<A8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R8_UNORM:
- GenerateMip<R8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- GenerateMip<A32B32G32R32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32G32B32_FLOAT:
- GenerateMip<R32G32B32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- GenerateMip<A16B16G16R16F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R8G8_UNORM:
- GenerateMip<R8G8>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R16_FLOAT:
- GenerateMip<R16F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R16G16_FLOAT:
- GenerateMip<R16G16F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32_FLOAT:
- GenerateMip<R32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- case DXGI_FORMAT_R32G32_FLOAT:
- GenerateMip<R32G32F>(src->getWidth(), src->getHeight(), sourceData, srcMapped.RowPitch, destData, destMapped.RowPitch);
- break;
- default:
- UNREACHABLE();
- break;
- }
</del><ins>+ ERR("Failed to map source image for mip map generation. HRESULT:0x%X", srcMapResult);
</ins><span class="cx">
</span><span class="cx"> dest->unmap();
</span><del>- src->unmap();
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ const unsigned char *sourceData = reinterpret_cast<const unsigned char*>(srcMapped.pData);
+ unsigned char *destData = reinterpret_cast<unsigned char*>(destMapped.pData);
+
+ mipFunction(src->getWidth(), src->getHeight(), src->getDepth(), sourceData, srcMapped.RowPitch, srcMapped.DepthPitch,
+ destData, destMapped.RowPitch, destMapped.DepthPitch);
+
+ dest->unmap();
+ src->unmap();
+
</ins><span class="cx"> dest->markDirty();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool FormatRequiresInitialization(DXGI_FORMAT dxgiFormat, GLenum internalFormat)
-{
- return (dxgiFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(internalFormat) == 0) ||
- (dxgiFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(internalFormat) == 0);
-}
-
</del><span class="cx"> bool Image11::isDirty() const
</span><span class="cx"> {
</span><del>- return ((mStagingTexture || FormatRequiresInitialization(mDXGIFormat, mInternalFormat)) && mDirty);
</del><ins>+ // Make sure that this image is marked as dirty even if the staging texture hasn't been created yet
+ // if initialization is required before use.
+ return (mDirty && (mStagingTexture || gl_d3d11::RequiresTextureDataInitialization(mInternalFormat)));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image11::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</del><ins>+bool Image11::copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><span class="cx"> TextureStorage11_2D *storage11 = TextureStorage11_2D::makeTextureStorage11_2D(storage->getStorageInstance());
</span><del>- return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, 0, xoffset, yoffset, width, height);
</del><ins>+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, 0, xoffset, yoffset, 0, width, height, 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image11::updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</del><ins>+bool Image11::copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><span class="cx"> TextureStorage11_Cube *storage11 = TextureStorage11_Cube::makeTextureStorage11_Cube(storage->getStorageInstance());
</span><del>- return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, face, xoffset, yoffset, width, height);
</del><ins>+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, face, xoffset, yoffset, 0, width, height, 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image11::redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease)
</del><ins>+bool Image11::copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
</ins><span class="cx"> {
</span><ins>+ TextureStorage11_3D *storage11 = TextureStorage11_3D::makeTextureStorage11_3D(storage->getStorageInstance());
+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, 0, xoffset, yoffset, zoffset, width, height, depth);
+}
+
+bool Image11::copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height)
+{
+ TextureStorage11_2DArray *storage11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(storage->getStorageInstance());
+ return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, arrayLayer, xoffset, yoffset, 0, width, height, 1);
+}
+
+bool Image11::redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
+{
</ins><span class="cx"> if (mWidth != width ||
</span><span class="cx"> mHeight != height ||
</span><span class="cx"> mInternalFormat != internalformat ||
</span><span class="cx"> forceRelease)
</span><span class="cx"> {
</span><span class="cx"> mRenderer = Renderer11::makeRenderer11(renderer);
</span><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
</ins><span class="cx">
</span><span class="cx"> mWidth = width;
</span><span class="cx"> mHeight = height;
</span><ins>+ mDepth = depth;
</ins><span class="cx"> mInternalFormat = internalformat;
</span><ins>+ mTarget = target;
+
</ins><span class="cx"> // compute the d3d format that will be used
</span><del>- mDXGIFormat = gl_d3d11::ConvertTextureFormat(internalformat);
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(mDXGIFormat);
</del><ins>+ mDXGIFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mActualFormat = d3d11_gl::GetInternalFormat(mDXGIFormat, clientVersion);
+ mRenderable = gl_d3d11::GetRTVFormat(internalformat, clientVersion) != DXGI_FORMAT_UNKNOWN;
</ins><span class="cx">
</span><del>- if (mStagingTexture)
- {
- mStagingTexture->Release();
- mStagingTexture = NULL;
- }
-
</del><ins>+ SafeRelease(mStagingTexture);
+ mDirty = gl_d3d11::RequiresTextureDataInitialization(mInternalFormat);
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image11::isRenderableFormat() const
-{
- return TextureStorage11::IsTextureFormatRenderable(mDXGIFormat);
-}
-
</del><span class="cx"> DXGI_FORMAT Image11::getDXGIFormat() const
</span><span class="cx"> {
</span><span class="cx"> // this should only happen if the image hasn't been redefined first
</span><span class="lines">@@ -173,9 +151,17 @@
</span><span class="cx">
</span><span class="cx"> // Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
</span><span class="cx"> // into the target pixel rectangle.
</span><del>-void Image11::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input)
</del><ins>+void Image11::loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input)
</ins><span class="cx"> {
</span><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, type, clientVersion, width, unpackAlignment);
+ GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, type, clientVersion, width, height, unpackAlignment);
+ GLuint outputPixelSize = d3d11::GetFormatPixelBytes(mDXGIFormat);
+
+ LoadImageFunction loadFunction = d3d11::GetImageLoadFunction(mInternalFormat, type, clientVersion);
+ ASSERT(loadFunction != NULL);
+
</ins><span class="cx"> D3D11_MAPPED_SUBRESOURCE mappedImage;
</span><span class="cx"> HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
</span><span class="cx"> if (FAILED(result))
</span><span class="lines">@@ -183,82 +169,30 @@
</span><span class="cx"> ERR("Could not map image for loading.");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>-
- GLsizei inputPitch = gl::ComputePitch(width, mInternalFormat, unpackAlignment);
- size_t pixelSize = d3d11::ComputePixelSizeBits(mDXGIFormat) / 8;
- void* offsetMappedData = (void*)((BYTE *)mappedImage.pData + (yoffset * mappedImage.RowPitch + xoffset * pixelSize));
</del><span class="cx">
</span><del>- switch (mInternalFormat)
- {
- case GL_ALPHA8_EXT:
- loadAlphaDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE8_EXT:
- loadLuminanceDataToNativeOrBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData, false);
- break;
- case GL_ALPHA32F_EXT:
- loadAlphaFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE32F_EXT:
- loadLuminanceFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_ALPHA16F_EXT:
- loadAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE16F_EXT:
- loadLuminanceHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE8_ALPHA8_EXT:
- loadLuminanceAlphaDataToNativeOrBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData, false);
- break;
- case GL_LUMINANCE_ALPHA32F_EXT:
- loadLuminanceAlphaFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_LUMINANCE_ALPHA16F_EXT:
- loadLuminanceAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB8_OES:
- loadRGBUByteDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB565:
- loadRGB565DataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA8_OES:
- loadRGBAUByteDataToNative(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA4:
- loadRGBA4444DataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB5_A1:
- loadRGBA5551DataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_BGRA8_EXT:
- loadBGRADataToBGRA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB32F_EXT:
- loadRGBFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGB16F_EXT:
- loadRGBHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA32F_EXT:
- loadRGBAFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- case GL_RGBA16F_EXT:
- loadRGBAHalfFloatDataToRGBA(width, height, inputPitch, input, mappedImage.RowPitch, offsetMappedData);
- break;
- default: UNREACHABLE();
- }
</del><ins>+ void* offsetMappedData = (void*)((BYTE *)mappedImage.pData + (yoffset * mappedImage.RowPitch + xoffset * outputPixelSize + zoffset * mappedImage.DepthPitch));
+ loadFunction(width, height, depth, input, inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
</ins><span class="cx">
</span><span class="cx"> unmap();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- const void *input)
</del><ins>+void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ const void *input)
</ins><span class="cx"> {
</span><del>- ASSERT(xoffset % 4 == 0);
- ASSERT(yoffset % 4 == 0);
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, 1);
+ GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
</ins><span class="cx">
</span><ins>+ GLuint outputPixelSize = d3d11::GetFormatPixelBytes(mDXGIFormat);
+ GLuint outputBlockWidth = d3d11::GetBlockWidth(mDXGIFormat);
+ GLuint outputBlockHeight = d3d11::GetBlockHeight(mDXGIFormat);
+
+ ASSERT(xoffset % outputBlockWidth == 0);
+ ASSERT(yoffset % outputBlockHeight == 0);
+
+ LoadImageFunction loadFunction = d3d11::GetImageLoadFunction(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion);
+ ASSERT(loadFunction != NULL);
+
</ins><span class="cx"> D3D11_MAPPED_SUBRESOURCE mappedImage;
</span><span class="cx"> HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
</span><span class="cx"> if (FAILED(result))
</span><span class="lines">@@ -267,26 +201,21 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Size computation assumes a 4x4 block compressed texture format
- size_t blockSize = d3d11::ComputeBlockSizeBits(mDXGIFormat) / 8;
- void* offsetMappedData = (void*)((BYTE *)mappedImage.pData + ((yoffset / 4) * mappedImage.RowPitch + (xoffset / 4) * blockSize));
</del><ins>+ void* offsetMappedData = (void*)((BYTE*)mappedImage.pData + ((yoffset / outputBlockHeight) * mappedImage.RowPitch +
+ (xoffset / outputBlockWidth) * outputPixelSize +
+ zoffset * mappedImage.DepthPitch));
</ins><span class="cx">
</span><del>- GLsizei inputSize = gl::ComputeCompressedSize(width, height, mInternalFormat);
- GLsizei inputPitch = gl::ComputeCompressedPitch(width, mInternalFormat);
- int rows = inputSize / inputPitch;
- for (int i = 0; i < rows; ++i)
- {
- memcpy((void*)((BYTE*)offsetMappedData + i * mappedImage.RowPitch), (void*)((BYTE*)input + i * inputPitch), inputPitch);
- }
</del><ins>+ loadFunction(width, height, depth, input, inputRowPitch, inputDepthPitch,
+ offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
</ins><span class="cx">
</span><span class="cx"> unmap();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Image11::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
</del><ins>+void Image11::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
</ins><span class="cx"> {
</span><span class="cx"> gl::Renderbuffer *colorbuffer = source->getReadColorbuffer();
</span><span class="cx">
</span><del>- if (colorbuffer && colorbuffer->getActualFormat() == (GLuint)mActualFormat)
</del><ins>+ if (colorbuffer && colorbuffer->getActualFormat() == mActualFormat)
</ins><span class="cx"> {
</span><span class="cx"> // No conversion needed-- use copyback fastpath
</span><span class="cx"> ID3D11Texture2D *colorBufferTexture = NULL;
</span><span class="lines">@@ -340,10 +269,10 @@
</span><span class="cx"> srcBox.front = 0;
</span><span class="cx"> srcBox.back = 1;
</span><span class="cx">
</span><del>- deviceContext->CopySubresourceRegion(mStagingTexture, 0, xoffset, yoffset, 0, srcTex, subresourceIndex, &srcBox);
</del><ins>+ deviceContext->CopySubresourceRegion(mStagingTexture, 0, xoffset, yoffset, zoffset, srcTex, subresourceIndex, &srcBox);
</ins><span class="cx">
</span><del>- srcTex->Release();
- colorBufferTexture->Release();
</del><ins>+ SafeRelease(srcTex);
+ SafeRelease(colorBufferTexture);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -351,19 +280,27 @@
</span><span class="cx"> // This format requires conversion, so we must copy the texture to staging and manually convert via readPixels
</span><span class="cx"> D3D11_MAPPED_SUBRESOURCE mappedImage;
</span><span class="cx"> HRESULT result = map(D3D11_MAP_WRITE, &mappedImage);
</span><ins>+ if (FAILED(result))
+ {
+ ERR("Failed to map texture for Image11::copy, HRESULT: 0x%X.", result);
+ return;
+ }
</ins><span class="cx">
</span><span class="cx"> // determine the offset coordinate into the destination buffer
</span><del>- GLsizei rowOffset = gl::ComputePixelSize(mActualFormat) * xoffset;
- void *dataOffset = static_cast<unsigned char*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset;
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei rowOffset = gl::GetPixelBytes(mActualFormat, clientVersion) * xoffset;
+ void *dataOffset = static_cast<unsigned char*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset + zoffset * mappedImage.DepthPitch;
</ins><span class="cx">
</span><del>- mRenderer->readPixels(source, x, y, width, height, gl::ExtractFormat(mInternalFormat),
- gl::ExtractType(mInternalFormat), mappedImage.RowPitch, false, 4, dataOffset);
</del><ins>+ GLenum format = gl::GetFormat(mInternalFormat, clientVersion);
+ GLenum type = gl::GetType(mInternalFormat, clientVersion);
</ins><span class="cx">
</span><ins>+ mRenderer->readPixels(source, x, y, width, height, format, type, mappedImage.RowPitch, gl::PixelPackState(), dataOffset);
+
</ins><span class="cx"> unmap();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ID3D11Texture2D *Image11::getStagingTexture()
</del><ins>+ID3D11Resource *Image11::getStagingTexture()
</ins><span class="cx"> {
</span><span class="cx"> createStagingTexture();
</span><span class="cx">
</span><span class="lines">@@ -377,27 +314,6 @@
</span><span class="cx"> return mStagingSubresource;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template <typename T, size_t N>
-static void setDefaultData(ID3D11DeviceContext *deviceContext, ID3D11Texture2D *texture, UINT subresource,
- GLsizei width, GLsizei height, const T (&defaultData)[N])
-{
- D3D11_MAPPED_SUBRESOURCE map;
- deviceContext->Map(texture, subresource, D3D11_MAP_WRITE, 0, &map);
-
- unsigned char* ptr = reinterpret_cast<unsigned char*>(map.pData);
- size_t pixelSize = sizeof(T) * N;
-
- for (GLsizei y = 0; y < height; y++)
- {
- for (GLsizei x = 0; x < width; x++)
- {
- memcpy(ptr + (y * map.RowPitch) + (x * pixelSize), defaultData, pixelSize);
- }
- }
-
- deviceContext->Unmap(texture, subresource);
-}
-
</del><span class="cx"> void Image11::createStagingTexture()
</span><span class="cx"> {
</span><span class="cx"> if (mStagingTexture)
</span><span class="lines">@@ -405,57 +321,107 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ID3D11Texture2D *newTexture = NULL;
- int lodOffset = 1;
</del><span class="cx"> const DXGI_FORMAT dxgiFormat = getDXGIFormat();
</span><del>- ASSERT(!d3d11::IsDepthStencilFormat(dxgiFormat)); // We should never get here for depth textures
</del><span class="cx">
</span><del>- if (mWidth != 0 && mHeight != 0)
</del><ins>+ if (mWidth > 0 && mHeight > 0 && mDepth > 0)
</ins><span class="cx"> {
</span><ins>+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result;
+
+ int lodOffset = 1;
</ins><span class="cx"> GLsizei width = mWidth;
</span><span class="cx"> GLsizei height = mHeight;
</span><span class="cx">
</span><span class="cx"> // adjust size if needed for compressed textures
</span><del>- gl::MakeValidSize(false, d3d11::IsCompressed(dxgiFormat), &width, &height, &lodOffset);
- ID3D11Device *device = mRenderer->getDevice();
</del><ins>+ d3d11::MakeValidSize(false, dxgiFormat, &width, &height, &lodOffset);
</ins><span class="cx">
</span><del>- 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;
</del><ins>+ if (mTarget == GL_TEXTURE_3D)
+ {
+ ID3D11Texture3D *newTexture = NULL;
</ins><span class="cx">
</span><del>- HRESULT result = device->CreateTexture2D(&desc, NULL, &newTexture);
</del><ins>+ 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;
</ins><span class="cx">
</span><del>- if (FAILED(result))
</del><ins>+ if (gl_d3d11::RequiresTextureDataInitialization(mInternalFormat))
+ {
+ std::vector<D3D11_SUBRESOURCE_DATA> initialData;
+ std::vector< std::vector<BYTE> > textureData;
+ d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getCurrentClientVersion(), width, height,
+ mDepth, lodOffset + 1, &initialData, &textureData);
+
+ result = device->CreateTexture3D(&desc, initialData.data(), &newTexture);
+ }
+ else
+ {
+ result = device->CreateTexture3D(&desc, NULL, &newTexture);
+ }
+
+ if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ mStagingTexture = newTexture;
+ mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
+ }
+ else if (mTarget == GL_TEXTURE_2D || mTarget == GL_TEXTURE_2D_ARRAY || mTarget == GL_TEXTURE_CUBE_MAP)
</ins><span class="cx"> {
</span><del>- ASSERT(result == E_OUTOFMEMORY);
- ERR("Creating image failed.");
- return gl::error(GL_OUT_OF_MEMORY);
</del><ins>+ 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 (gl_d3d11::RequiresTextureDataInitialization(mInternalFormat))
+ {
+ std::vector<D3D11_SUBRESOURCE_DATA> initialData;
+ std::vector< std::vector<BYTE> > textureData;
+ d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getCurrentClientVersion(), width, height,
+ 1, lodOffset + 1, &initialData, &textureData);
+
+ result = device->CreateTexture2D(&desc, initialData.data(), &newTexture);
+ }
+ else
+ {
+ result = device->CreateTexture2D(&desc, NULL, &newTexture);
+ }
+
+ if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ mStagingTexture = newTexture;
+ mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ UNREACHABLE();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- mStagingTexture = newTexture;
- mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
</del><span class="cx"> mDirty = false;
</span><del>-
- if (mDXGIFormat == DXGI_FORMAT_R8G8B8A8_UNORM && gl::GetAlphaSize(mInternalFormat) == 0)
- {
- unsigned char defaultPixel[4] = { 0, 0, 0, 255 };
- setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
- }
- else if (mDXGIFormat == DXGI_FORMAT_R32G32B32A32_FLOAT && gl::GetAlphaSize(mInternalFormat) == 0)
- {
- float defaultPixel[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
- setDefaultData(mRenderer->getDeviceContext(), mStagingTexture, mStagingSubresource, mWidth, mHeight, defaultPixel);
- }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HRESULT Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Image11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Image11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -34,24 +34,25 @@
</span><span class="cx">
</span><span class="cx"> static Image11 *makeImage11(Image *img);
</span><span class="cx">
</span><del>- static void generateMipmap(Image11 *dest, Image11 *src);
</del><ins>+ static void generateMipmap(GLuint clientVersion, Image11 *dest, Image11 *src);
</ins><span class="cx">
</span><span class="cx"> virtual bool isDirty() const;
</span><span class="cx">
</span><del>- virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
- virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
</del><ins>+ virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
+ virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height);
</ins><span class="cx">
</span><del>- virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease);
</del><ins>+ virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
</ins><span class="cx">
</span><del>- virtual bool isRenderableFormat() const;
</del><span class="cx"> DXGI_FORMAT getDXGIFormat() const;
</span><span class="cx">
</span><del>- virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input);
- virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
</del><ins>+ virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input);
+ virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
</ins><span class="cx"> const void *input);
</span><span class="cx">
</span><del>- virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
</del><ins>+ virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> HRESULT map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
</span><span class="lines">@@ -60,14 +61,14 @@
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Image11);
</span><span class="cx">
</span><del>- ID3D11Texture2D *getStagingTexture();
</del><ins>+ ID3D11Resource *getStagingTexture();
</ins><span class="cx"> unsigned int getStagingSubresource();
</span><span class="cx"> void createStagingTexture();
</span><span class="cx">
</span><span class="cx"> Renderer11 *mRenderer;
</span><span class="cx">
</span><span class="cx"> DXGI_FORMAT mDXGIFormat;
</span><del>- ID3D11Texture2D *mStagingTexture;
</del><ins>+ ID3D11Resource *mStagingTexture;
</ins><span class="cx"> unsigned int mStagingSubresource;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11IndexBuffer11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/IndexBuffer11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -22,20 +22,12 @@
</span><span class="cx">
</span><span class="cx"> IndexBuffer11::~IndexBuffer11()
</span><span class="cx"> {
</span><del>- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
</del><ins>+ SafeRelease(mBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool IndexBuffer11::initialize(unsigned int bufferSize, GLenum indexType, bool dynamic)
</span><span class="cx"> {
</span><del>- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
</del><ins>+ SafeRelease(mBuffer);
</ins><span class="cx">
</span><span class="cx"> updateSerial();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11InputLayoutCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -13,14 +13,30 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/BufferStorage11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
</span><span class="cx"> #include "libGLESv2/ProgramBinary.h"
</span><del>-#include "libGLESv2/Context.h"
</del><ins>+#include "libGLESv2/VertexAttribute.h"
</ins><span class="cx"> #include "libGLESv2/renderer/VertexDataManager.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx">
</span><span class="cx"> #include "third_party/murmurhash/MurmurHash3.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><ins>+static void GetInputLayout(const TranslatedAttribute translatedAttributes[gl::MAX_VERTEX_ATTRIBS],
+ gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS])
+{
+ for (unsigned int attributeIndex = 0; attributeIndex < gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ const TranslatedAttribute &translatedAttribute = translatedAttributes[attributeIndex];
+
+ if (translatedAttributes[attributeIndex].active)
+ {
+ inputLayout[attributeIndex] = gl::VertexFormat(*translatedAttribute.attribute,
+ translatedAttribute.currentValueType);
+ }
+ }
+}
+
</ins><span class="cx"> const unsigned int InputLayoutCache::kMaxInputLayouts = 1024;
</span><span class="cx">
</span><span class="cx"> InputLayoutCache::InputLayoutCache() : mInputLayoutMap(kMaxInputLayouts, hashInputLayout, compareInputLayouts)
</span><span class="lines">@@ -31,7 +47,7 @@
</span><span class="cx"> mCurrentIL = NULL;
</span><span class="cx"> for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
</span><span class="cx"> {
</span><del>- mCurrentBuffers[i] = -1;
</del><ins>+ mCurrentBuffers[i] = NULL;
</ins><span class="cx"> mCurrentVertexStrides[i] = -1;
</span><span class="cx"> mCurrentVertexOffsets[i] = -1;
</span><span class="cx"> }
</span><span class="lines">@@ -53,7 +69,7 @@
</span><span class="cx"> {
</span><span class="cx"> for (InputLayoutMap::iterator i = mInputLayoutMap.begin(); i != mInputLayoutMap.end(); i++)
</span><span class="cx"> {
</span><del>- i->second.inputLayout->Release();
</del><ins>+ SafeRelease(i->second.inputLayout);
</ins><span class="cx"> }
</span><span class="cx"> mInputLayoutMap.clear();
</span><span class="cx"> markDirty();
</span><span class="lines">@@ -64,7 +80,7 @@
</span><span class="cx"> mCurrentIL = NULL;
</span><span class="cx"> for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
</span><span class="cx"> {
</span><del>- mCurrentBuffers[i] = -1;
</del><ins>+ mCurrentBuffers[i] = NULL;
</ins><span class="cx"> mCurrentVertexStrides[i] = -1;
</span><span class="cx"> mCurrentVertexOffsets[i] = -1;
</span><span class="cx"> }
</span><span class="lines">@@ -85,7 +101,6 @@
</span><span class="cx"> InputLayoutKey ilKey = { 0 };
</span><span class="cx">
</span><span class="cx"> ID3D11Buffer *vertexBuffers[gl::MAX_VERTEX_ATTRIBS] = { NULL };
</span><del>- unsigned int vertexBufferSerials[gl::MAX_VERTEX_ATTRIBS] = { 0 };
</del><span class="cx"> UINT vertexStrides[gl::MAX_VERTEX_ATTRIBS] = { 0 };
</span><span class="cx"> UINT vertexOffsets[gl::MAX_VERTEX_ATTRIBS] = { 0 };
</span><span class="cx">
</span><span class="lines">@@ -100,6 +115,9 @@
</span><span class="cx">
</span><span class="cx"> D3D11_INPUT_CLASSIFICATION inputClass = attributes[i].divisor > 0 ? D3D11_INPUT_PER_INSTANCE_DATA : D3D11_INPUT_PER_VERTEX_DATA;
</span><span class="cx">
</span><ins>+ gl::VertexFormat vertexFormat(*attributes[i].attribute, attributes[i].currentValueType);
+ DXGI_FORMAT dxgiFormat = gl_d3d11::GetNativeVertexFormat(vertexFormat);
+
</ins><span class="cx"> // Record the type of the associated vertex shader vector in our key
</span><span class="cx"> // This will prevent mismatched vertex shaders from using the same input layout
</span><span class="cx"> GLint attributeSize;
</span><span class="lines">@@ -107,15 +125,15 @@
</span><span class="cx">
</span><span class="cx"> ilKey.elements[ilKey.elementCount].desc.SemanticName = semanticName;
</span><span class="cx"> ilKey.elements[ilKey.elementCount].desc.SemanticIndex = sortedSemanticIndices[i];
</span><del>- ilKey.elements[ilKey.elementCount].desc.Format = attributes[i].attribute->mArrayEnabled ? vertexBuffer->getDXGIFormat(*attributes[i].attribute) : DXGI_FORMAT_R32G32B32A32_FLOAT;
</del><ins>+ ilKey.elements[ilKey.elementCount].desc.Format = dxgiFormat;
</ins><span class="cx"> ilKey.elements[ilKey.elementCount].desc.InputSlot = i;
</span><span class="cx"> ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
</span><span class="cx"> ilKey.elements[ilKey.elementCount].desc.InputSlotClass = inputClass;
</span><span class="cx"> ilKey.elements[ilKey.elementCount].desc.InstanceDataStepRate = attributes[i].divisor;
</span><span class="cx"> ilKey.elementCount++;
</span><span class="cx">
</span><del>- vertexBuffers[i] = bufferStorage ? bufferStorage->getBuffer(BUFFER_USAGE_VERTEX) : vertexBuffer->getBuffer();
- vertexBufferSerials[i] = bufferStorage ? bufferStorage->getSerial() : vertexBuffer->getSerial();
</del><ins>+ vertexBuffers[i] = bufferStorage ? bufferStorage->getBuffer(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK)
+ : vertexBuffer->getBuffer();
</ins><span class="cx"> vertexStrides[i] = attributes[i].stride;
</span><span class="cx"> vertexOffsets[i] = attributes[i].offset;
</span><span class="cx"> }
</span><span class="lines">@@ -123,15 +141,17 @@
</span><span class="cx">
</span><span class="cx"> ID3D11InputLayout *inputLayout = NULL;
</span><span class="cx">
</span><del>- InputLayoutMap::iterator i = mInputLayoutMap.find(ilKey);
- if (i != mInputLayoutMap.end())
</del><ins>+ InputLayoutMap::iterator keyIter = mInputLayoutMap.find(ilKey);
+ if (keyIter != mInputLayoutMap.end())
</ins><span class="cx"> {
</span><del>- inputLayout = i->second.inputLayout;
- i->second.lastUsedTime = mCounter++;
</del><ins>+ inputLayout = keyIter->second.inputLayout;
+ keyIter->second.lastUsedTime = mCounter++;
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- ShaderExecutable11 *shader = ShaderExecutable11::makeShaderExecutable11(programBinary->getVertexExecutable());
</del><ins>+ gl::VertexFormat shaderInputLayout[gl::MAX_VERTEX_ATTRIBS];
+ GetInputLayout(attributes, shaderInputLayout);
+ ShaderExecutable11 *shader = ShaderExecutable11::makeShaderExecutable11(programBinary->getVertexExecutableForInputLayout(shaderInputLayout));
</ins><span class="cx">
</span><span class="cx"> D3D11_INPUT_ELEMENT_DESC descs[gl::MAX_VERTEX_ATTRIBS];
</span><span class="cx"> for (unsigned int j = 0; j < ilKey.elementCount; ++j)
</span><span class="lines">@@ -159,7 +179,7 @@
</span><span class="cx"> leastRecentlyUsed = i;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- leastRecentlyUsed->second.inputLayout->Release();
</del><ins>+ SafeRelease(leastRecentlyUsed->second.inputLayout);
</ins><span class="cx"> mInputLayoutMap.erase(leastRecentlyUsed);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -178,11 +198,11 @@
</span><span class="cx">
</span><span class="cx"> for (unsigned int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
</span><span class="cx"> {
</span><del>- if (vertexBufferSerials[i] != mCurrentBuffers[i] || vertexStrides[i] != mCurrentVertexStrides[i] ||
</del><ins>+ if (vertexBuffers[i] != mCurrentBuffers[i] || vertexStrides[i] != mCurrentVertexStrides[i] ||
</ins><span class="cx"> vertexOffsets[i] != mCurrentVertexOffsets[i])
</span><span class="cx"> {
</span><span class="cx"> mDeviceContext->IASetVertexBuffers(i, 1, &vertexBuffers[i], &vertexStrides[i], &vertexOffsets[i]);
</span><del>- mCurrentBuffers[i] = vertexBufferSerials[i];
</del><ins>+ mCurrentBuffers[i] = vertexBuffers[i];
</ins><span class="cx"> mCurrentVertexStrides[i] = vertexStrides[i];
</span><span class="cx"> mCurrentVertexOffsets[i] = vertexOffsets[i];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11InputLayoutCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/InputLayoutCache.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> ID3D11InputLayout *mCurrentIL;
</span><del>- unsigned int mCurrentBuffers[gl::MAX_VERTEX_ATTRIBS];
</del><ins>+ ID3D11Buffer *mCurrentBuffers[gl::MAX_VERTEX_ATTRIBS];
</ins><span class="cx"> UINT mCurrentVertexStrides[gl::MAX_VERTEX_ATTRIBS];
</span><span class="cx"> UINT mCurrentVertexOffsets[gl::MAX_VERTEX_ATTRIBS];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Query11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Query11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Query11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Query11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -9,11 +9,26 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Query11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Renderer11.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</ins><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><ins>+static bool checkOcclusionQuery(ID3D11DeviceContext *context, ID3D11Query *query, UINT64 *numPixels)
+{
+ HRESULT result = context->GetData(query, numPixels, sizeof(UINT64), 0);
+ return (result == S_OK);
+}
+
+static bool checkStreamOutPrimitivesWritten(ID3D11DeviceContext *context, ID3D11Query *query, UINT64 *numPrimitives)
+{
+ D3D11_QUERY_DATA_SO_STATISTICS soStats = { 0 };
+ HRESULT result = context->GetData(query, &soStats, sizeof(D3D11_QUERY_DATA_SO_STATISTICS), 0);
+ *numPrimitives = soStats.NumPrimitivesWritten;
+ return (result == S_OK);
+}
+
</ins><span class="cx"> Query11::Query11(rx::Renderer11 *renderer, GLenum type) : QueryImpl(type)
</span><span class="cx"> {
</span><span class="cx"> mRenderer = renderer;
</span><span class="lines">@@ -22,11 +37,7 @@
</span><span class="cx">
</span><span class="cx"> Query11::~Query11()
</span><span class="cx"> {
</span><del>- if (mQuery)
- {
- mQuery->Release();
- mQuery = NULL;
- }
</del><ins>+ SafeRelease(mQuery);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Query11::begin()
</span><span class="lines">@@ -34,7 +45,7 @@
</span><span class="cx"> if (mQuery == NULL)
</span><span class="cx"> {
</span><span class="cx"> D3D11_QUERY_DESC queryDesc;
</span><del>- queryDesc.Query = D3D11_QUERY_OCCLUSION;
</del><ins>+ queryDesc.Query = gl_d3d11::ConvertQueryType(getType());
</ins><span class="cx"> queryDesc.MiscFlags = 0;
</span><span class="cx">
</span><span class="cx"> if (FAILED(mRenderer->getDevice()->CreateQuery(&queryDesc, &mQuery)))
</span><span class="lines">@@ -92,22 +103,43 @@
</span><span class="cx"> {
</span><span class="cx"> if (mQuery != NULL && mStatus != GL_TRUE)
</span><span class="cx"> {
</span><del>- UINT64 numPixels = 0;
- HRESULT result = mRenderer->getDeviceContext()->GetData(mQuery, &numPixels, sizeof(UINT64), 0);
- if (result == S_OK)
</del><ins>+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ bool queryFinished = false;
+ switch (getType())
</ins><span class="cx"> {
</span><del>- mStatus = GL_TRUE;
</del><ins>+ case GL_ANY_SAMPLES_PASSED_EXT:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+ {
+ UINT64 numPixels = 0;
+ queryFinished = checkOcclusionQuery(context, mQuery, &numPixels);
+ if (queryFinished)
+ {
+ mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
+ }
+ }
+ break;
</ins><span class="cx">
</span><del>- switch (getType())
</del><ins>+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
</ins><span class="cx"> {
</span><del>- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
- break;
- default:
- UNREACHABLE();
</del><ins>+ UINT64 numPrimitives = 0;
+ queryFinished = checkStreamOutPrimitivesWritten(context, mQuery, &numPrimitives);
+ if (queryFinished)
+ {
+ mResult = static_cast<GLuint>(numPrimitives);
+ }
</ins><span class="cx"> }
</span><ins>+ break;
+
+ default:
+ UNREACHABLE();
+ break;
</ins><span class="cx"> }
</span><ins>+
+ if (queryFinished)
+ {
+ mStatus = GL_TRUE;
+ }
</ins><span class="cx"> else if (mRenderer->testDeviceLost(true))
</span><span class="cx"> {
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderStateCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,16 +10,26 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/RenderStateCache.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</span><del>-
</del><ins>+#include "libGLESv2/renderer/Renderer.h"
</ins><span class="cx"> #include "libGLESv2/Framebuffer.h"
</span><span class="cx"> #include "libGLESv2/Renderbuffer.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+
</ins><span class="cx"> #include "common/debug.h"
</span><span class="cx"> #include "third_party/murmurhash/MurmurHash3.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><ins>+template <typename mapType>
+static void ClearStateMap(mapType &map)
+{
+ for (mapType::iterator i = map.begin(); i != map.end(); i++)
+ {
+ SafeRelease(i->second.first);
+ }
+ map.clear();
+}
+
</ins><span class="cx"> // MSDN's documentation of ID3D11Device::CreateBlendState, ID3D11Device::CreateRasterizerState,
</span><span class="cx"> // ID3D11Device::CreateDepthStencilState and ID3D11Device::CreateSamplerState claims the maximum
</span><span class="cx"> // number of unique states of each type an application can create is 4096
</span><span class="lines">@@ -49,29 +59,10 @@
</span><span class="cx">
</span><span class="cx"> void RenderStateCache::clear()
</span><span class="cx"> {
</span><del>- for (BlendStateMap::iterator i = mBlendStateCache.begin(); i != mBlendStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mBlendStateCache.clear();
-
- for (RasterizerStateMap::iterator i = mRasterizerStateCache.begin(); i != mRasterizerStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mRasterizerStateCache.clear();
-
- for (DepthStencilStateMap::iterator i = mDepthStencilStateCache.begin(); i != mDepthStencilStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mDepthStencilStateCache.clear();
-
- for (SamplerStateMap::iterator i = mSamplerStateCache.begin(); i != mSamplerStateCache.end(); i++)
- {
- i->second.first->Release();
- }
- mSamplerStateCache.clear();
</del><ins>+ ClearStateMap(mBlendStateCache);
+ ClearStateMap(mRasterizerStateCache);
+ ClearStateMap(mDepthStencilStateCache);
+ ClearStateMap(mSamplerStateCache);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::size_t RenderStateCache::hashBlendState(const BlendStateKey &blendState)
</span><span class="lines">@@ -79,16 +70,16 @@
</span><span class="cx"> static const unsigned int seed = 0xABCDEF98;
</span><span class="cx">
</span><span class="cx"> std::size_t hash = 0;
</span><del>- MurmurHash3_x86_32(&blendState, sizeof(BlendStateKey), seed, &hash);
</del><ins>+ MurmurHash3_x86_32(&blendState, sizeof(gl::BlendState), seed, &hash);
</ins><span class="cx"> return hash;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderStateCache::compareBlendStates(const BlendStateKey &a, const BlendStateKey &b)
</span><span class="cx"> {
</span><del>- return memcmp(&a, &b, sizeof(gl::BlendState)) == 0;
</del><ins>+ return memcmp(&a, &b, sizeof(BlendStateKey)) == 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-ID3D11BlendState *RenderStateCache::getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState)
</del><ins>+ID3D11BlendState *RenderStateCache::getBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &blendState)
</ins><span class="cx"> {
</span><span class="cx"> if (!mDevice)
</span><span class="cx"> {
</span><span class="lines">@@ -110,11 +101,10 @@
</span><span class="cx"> mrt = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GLenum internalFormat = renderBuffer->getInternalFormat();
- key.rtChannels[i][0] = gl::GetRedSize(internalFormat) > 0;
- key.rtChannels[i][1] = gl::GetGreenSize(internalFormat) > 0;
- key.rtChannels[i][2] = gl::GetBlueSize(internalFormat) > 0;;
- key.rtChannels[i][3] = gl::GetAlphaSize(internalFormat) > 0;
</del><ins>+ key.rtChannels[i][0] = renderBuffer->getRedSize() > 0;
+ key.rtChannels[i][1] = renderBuffer->getGreenSize() > 0;
+ key.rtChannels[i][2] = renderBuffer->getBlueSize() > 0;
+ key.rtChannels[i][3] = renderBuffer->getAlphaSize() > 0;
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -125,10 +115,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- BlendStateMap::iterator i = mBlendStateCache.find(key);
- if (i != mBlendStateCache.end())
</del><ins>+ BlendStateMap::iterator keyIter = mBlendStateCache.find(key);
+ if (keyIter != mBlendStateCache.end())
</ins><span class="cx"> {
</span><del>- BlendStateCounterPair &state = i->second;
</del><ins>+ BlendStateCounterPair &state = keyIter->second;
</ins><span class="cx"> state.second = mCounter++;
</span><span class="cx"> return state.first;
</span><span class="cx"> }
</span><span class="lines">@@ -147,7 +137,7 @@
</span><span class="cx"> leastRecentlyUsed = i;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- leastRecentlyUsed->second.first->Release();
</del><ins>+ SafeRelease(leastRecentlyUsed->second.first);
</ins><span class="cx"> mBlendStateCache.erase(leastRecentlyUsed);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -215,15 +205,15 @@
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- RasterizerStateKey key;
</del><ins>+ RasterizerStateKey key = { 0 };
</ins><span class="cx"> key.rasterizerState = rasterState;
</span><span class="cx"> key.scissorEnabled = scissorEnabled;
</span><span class="cx"> key.depthSize = depthSize;
</span><span class="cx">
</span><del>- RasterizerStateMap::iterator i = mRasterizerStateCache.find(key);
- if (i != mRasterizerStateCache.end())
</del><ins>+ RasterizerStateMap::iterator keyIter = mRasterizerStateCache.find(key);
+ if (keyIter != mRasterizerStateCache.end())
</ins><span class="cx"> {
</span><del>- RasterizerStateCounterPair &state = i->second;
</del><ins>+ RasterizerStateCounterPair &state = keyIter->second;
</ins><span class="cx"> state.second = mCounter++;
</span><span class="cx"> return state.first;
</span><span class="cx"> }
</span><span class="lines">@@ -242,7 +232,7 @@
</span><span class="cx"> leastRecentlyUsed = i;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- leastRecentlyUsed->second.first->Release();
</del><ins>+ SafeRelease(leastRecentlyUsed->second.first);
</ins><span class="cx"> mRasterizerStateCache.erase(leastRecentlyUsed);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -302,10 +292,10 @@
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- DepthStencilStateMap::iterator i = mDepthStencilStateCache.find(dsState);
- if (i != mDepthStencilStateCache.end())
</del><ins>+ DepthStencilStateMap::iterator keyIter = mDepthStencilStateCache.find(dsState);
+ if (keyIter != mDepthStencilStateCache.end())
</ins><span class="cx"> {
</span><del>- DepthStencilStateCounterPair &state = i->second;
</del><ins>+ DepthStencilStateCounterPair &state = keyIter->second;
</ins><span class="cx"> state.second = mCounter++;
</span><span class="cx"> return state.first;
</span><span class="cx"> }
</span><span class="lines">@@ -324,7 +314,7 @@
</span><span class="cx"> leastRecentlyUsed = i;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- leastRecentlyUsed->second.first->Release();
</del><ins>+ SafeRelease(leastRecentlyUsed->second.first);
</ins><span class="cx"> mDepthStencilStateCache.erase(leastRecentlyUsed);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -380,10 +370,10 @@
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- SamplerStateMap::iterator i = mSamplerStateCache.find(samplerState);
- if (i != mSamplerStateCache.end())
</del><ins>+ SamplerStateMap::iterator keyIter = mSamplerStateCache.find(samplerState);
+ if (keyIter != mSamplerStateCache.end())
</ins><span class="cx"> {
</span><del>- SamplerStateCounterPair &state = i->second;
</del><ins>+ SamplerStateCounterPair &state = keyIter->second;
</ins><span class="cx"> state.second = mCounter++;
</span><span class="cx"> return state.first;
</span><span class="cx"> }
</span><span class="lines">@@ -402,24 +392,25 @@
</span><span class="cx"> leastRecentlyUsed = i;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- leastRecentlyUsed->second.first->Release();
</del><ins>+ SafeRelease(leastRecentlyUsed->second.first);
</ins><span class="cx"> mSamplerStateCache.erase(leastRecentlyUsed);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> D3D11_SAMPLER_DESC samplerDesc;
</span><del>- samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter, samplerState.maxAnisotropy);
</del><ins>+ samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter,
+ samplerState.maxAnisotropy, samplerState.compareMode);
</ins><span class="cx"> samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.wrapS);
</span><span class="cx"> samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT);
</span><del>- samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
- samplerDesc.MipLODBias = static_cast<float>(samplerState.lodOffset);
</del><ins>+ samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR);
+ samplerDesc.MipLODBias = 0;
</ins><span class="cx"> samplerDesc.MaxAnisotropy = samplerState.maxAnisotropy;
</span><del>- samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
</del><ins>+ samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.compareFunc);
</ins><span class="cx"> samplerDesc.BorderColor[0] = 0.0f;
</span><span class="cx"> samplerDesc.BorderColor[1] = 0.0f;
</span><span class="cx"> samplerDesc.BorderColor[2] = 0.0f;
</span><span class="cx"> samplerDesc.BorderColor[3] = 0.0f;
</span><del>- samplerDesc.MinLOD = gl_d3d11::ConvertMinLOD(samplerState.minFilter, samplerState.lodOffset);
- samplerDesc.MaxLOD = gl_d3d11::ConvertMaxLOD(samplerState.minFilter, samplerState.lodOffset);
</del><ins>+ samplerDesc.MinLOD = samplerState.minLod;
+ samplerDesc.MaxLOD = samplerState.maxLod;
</ins><span class="cx">
</span><span class="cx"> ID3D11SamplerState *dx11SamplerState = NULL;
</span><span class="cx"> HRESULT result = mDevice->CreateSamplerState(&samplerDesc, &dx11SamplerState);
</span><span class="lines">@@ -435,4 +426,4 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderStateCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderStateCache.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -30,8 +30,7 @@
</span><span class="cx"> void initialize(ID3D11Device *device);
</span><span class="cx"> void clear();
</span><span class="cx">
</span><del>- // Increments refcount on the returned blend state, Release() must be called.
- ID3D11BlendState *getBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState);
</del><ins>+ ID3D11BlendState *getBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &blendState);
</ins><span class="cx"> ID3D11RasterizerState *getRasterizerState(const gl::RasterizerState &rasterState,
</span><span class="cx"> bool scissorEnabled, unsigned int depthSize);
</span><span class="cx"> ID3D11DepthStencilState *getDepthStencilState(const gl::DepthStencilState &dsState);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderTarget11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,22 +12,63 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Renderer11.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><del>-static unsigned int getRTVSubresourceIndex(ID3D11Texture2D *texture, ID3D11RenderTargetView *view)
</del><ins>+static bool getTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, unsigned int *samples)
</ins><span class="cx"> {
</span><ins>+ ID3D11Texture1D *texture1D = d3d11::DynamicCastComObject<ID3D11Texture1D>(resource);
+ if (texture1D)
+ {
+ D3D11_TEXTURE1D_DESC texDesc;
+ texture1D->GetDesc(&texDesc);
+ SafeRelease(texture1D);
+
+ *mipLevels = texDesc.MipLevels;
+ *samples = 0;
+
+ return true;
+ }
+
+ ID3D11Texture2D *texture2D = d3d11::DynamicCastComObject<ID3D11Texture2D>(resource);
+ if (texture2D)
+ {
+ D3D11_TEXTURE2D_DESC texDesc;
+ texture2D->GetDesc(&texDesc);
+ SafeRelease(texture2D);
+
+ *mipLevels = texDesc.MipLevels;
+ *samples = texDesc.SampleDesc.Count > 1 ? texDesc.SampleDesc.Count : 0;
+
+ return true;
+ }
+
+ ID3D11Texture3D *texture3D = d3d11::DynamicCastComObject<ID3D11Texture3D>(resource);
+ if (texture3D)
+ {
+ D3D11_TEXTURE3D_DESC texDesc;
+ texture3D->GetDesc(&texDesc);
+ SafeRelease(texture3D);
+
+ *mipLevels = texDesc.MipLevels;
+ *samples = 0;
+
+ return true;
+ }
+
+ return false;
+}
+
+static unsigned int getRTVSubresourceIndex(ID3D11Resource *resource, ID3D11RenderTargetView *view)
+{
</ins><span class="cx"> D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
</span><span class="cx"> view->GetDesc(&rtvDesc);
</span><span class="cx">
</span><del>- D3D11_TEXTURE2D_DESC texDesc;
- texture->GetDesc(&texDesc);
-
</del><span class="cx"> unsigned int mipSlice = 0;
</span><span class="cx"> unsigned int arraySlice = 0;
</span><del>- unsigned int mipLevels = texDesc.MipLevels;
</del><span class="cx">
</span><span class="cx"> switch (rtvDesc.ViewDimension)
</span><span class="cx"> {
</span><span class="lines">@@ -76,20 +117,19 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ unsigned int mipLevels, samples;
+ getTextureProperties(resource, &mipLevels, &samples);
+
</ins><span class="cx"> return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static unsigned int getDSVSubresourceIndex(ID3D11Texture2D *texture, ID3D11DepthStencilView *view)
</del><ins>+static unsigned int getDSVSubresourceIndex(ID3D11Resource *resource, ID3D11DepthStencilView *view)
</ins><span class="cx"> {
</span><span class="cx"> D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
</span><span class="cx"> view->GetDesc(&dsvDesc);
</span><span class="cx">
</span><del>- D3D11_TEXTURE2D_DESC texDesc;
- texture->GetDesc(&texDesc);
-
</del><span class="cx"> unsigned int mipSlice = 0;
</span><span class="cx"> unsigned int arraySlice = 0;
</span><del>- unsigned int mipLevels = texDesc.MipLevels;
</del><span class="cx">
</span><span class="cx"> switch (dsvDesc.ViewDimension)
</span><span class="cx"> {
</span><span class="lines">@@ -123,7 +163,7 @@
</span><span class="cx"> arraySlice = dsvDesc.Texture2DMSArray.FirstArraySlice;
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case D3D11_RTV_DIMENSION_UNKNOWN:
</del><ins>+ case D3D11_DSV_DIMENSION_UNKNOWN:
</ins><span class="cx"> UNIMPLEMENTED();
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -132,16 +172,37 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ unsigned int mipLevels, samples;
+ getTextureProperties(resource, &mipLevels, &samples);
+
</ins><span class="cx"> return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height)
</del><ins>+RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Resource *resource,
+ ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth)
</ins><span class="cx"> {
</span><span class="cx"> mRenderer = Renderer11::makeRenderer11(renderer);
</span><del>- mTexture = tex;
</del><ins>+
+ mTexture = resource;
+ if (mTexture)
+ {
+ mTexture->AddRef();
+ }
+
</ins><span class="cx"> mRenderTarget = rtv;
</span><ins>+ if (mRenderTarget)
+ {
+ mRenderTarget->AddRef();
+ }
+
</ins><span class="cx"> mDepthStencil = NULL;
</span><ins>+
</ins><span class="cx"> mShaderResource = srv;
</span><ins>+ if (mShaderResource)
+ {
+ mShaderResource->AddRef();
+ }
+
</ins><span class="cx"> mSubresourceIndex = 0;
</span><span class="cx">
</span><span class="cx"> if (mRenderTarget && mTexture)
</span><span class="lines">@@ -149,26 +210,45 @@
</span><span class="cx"> D3D11_RENDER_TARGET_VIEW_DESC desc;
</span><span class="cx"> mRenderTarget->GetDesc(&desc);
</span><span class="cx">
</span><del>- D3D11_TEXTURE2D_DESC texDesc;
- mTexture->GetDesc(&texDesc);
</del><ins>+ unsigned int mipLevels, samples;
+ getTextureProperties(mTexture, &mipLevels, &samples);
</ins><span class="cx">
</span><span class="cx"> mSubresourceIndex = getRTVSubresourceIndex(mTexture, mRenderTarget);
</span><span class="cx"> mWidth = width;
</span><span class="cx"> mHeight = height;
</span><del>- mSamples = (texDesc.SampleDesc.Count > 1) ? texDesc.SampleDesc.Count : 0;
</del><ins>+ mDepth = depth;
+ mSamples = samples;
</ins><span class="cx">
</span><del>- mInternalFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
</del><ins>+ mInternalFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
+ mActualFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height)
</del><ins>+RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Resource *resource,
+ ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth)
</ins><span class="cx"> {
</span><span class="cx"> mRenderer = Renderer11::makeRenderer11(renderer);
</span><del>- mTexture = tex;
</del><ins>+
+ mTexture = resource;
+ if (mTexture)
+ {
+ mTexture->AddRef();
+ }
+
</ins><span class="cx"> mRenderTarget = NULL;
</span><ins>+
</ins><span class="cx"> mDepthStencil = dsv;
</span><ins>+ if (mDepthStencil)
+ {
+ mDepthStencil->AddRef();
+ }
+
</ins><span class="cx"> mShaderResource = srv;
</span><ins>+ if (mShaderResource)
+ {
+ mShaderResource->AddRef();
+ }
+
</ins><span class="cx"> mSubresourceIndex = 0;
</span><span class="cx">
</span><span class="cx"> if (mDepthStencil && mTexture)
</span><span class="lines">@@ -176,20 +256,21 @@
</span><span class="cx"> D3D11_DEPTH_STENCIL_VIEW_DESC desc;
</span><span class="cx"> mDepthStencil->GetDesc(&desc);
</span><span class="cx">
</span><del>- D3D11_TEXTURE2D_DESC texDesc;
- mTexture->GetDesc(&texDesc);
</del><ins>+ unsigned int mipLevels, samples;
+ getTextureProperties(mTexture, &mipLevels, &samples);
</ins><span class="cx">
</span><span class="cx"> mSubresourceIndex = getDSVSubresourceIndex(mTexture, mDepthStencil);
</span><span class="cx"> mWidth = width;
</span><span class="cx"> mHeight = height;
</span><del>- mSamples = (texDesc.SampleDesc.Count > 1) ? texDesc.SampleDesc.Count : 0;
</del><ins>+ mDepth = depth;
+ mSamples = samples;
</ins><span class="cx">
</span><del>- mInternalFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
</del><ins>+ mInternalFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
+ mActualFormat = d3d11_gl::GetInternalFormat(desc.Format, renderer->getCurrentClientVersion());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples, bool depth)
</del><ins>+RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples)
</ins><span class="cx"> {
</span><span class="cx"> mRenderer = Renderer11::makeRenderer11(renderer);
</span><span class="cx"> mTexture = NULL;
</span><span class="lines">@@ -197,9 +278,15 @@
</span><span class="cx"> mDepthStencil = NULL;
</span><span class="cx"> mShaderResource = NULL;
</span><span class="cx">
</span><del>- DXGI_FORMAT requestedFormat = gl_d3d11::ConvertRenderbufferFormat(format);
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
</ins><span class="cx">
</span><del>- int supportedSamples = mRenderer->getNearestSupportedSamples(requestedFormat, samples);
</del><ins>+ DXGI_FORMAT texFormat = gl_d3d11::GetTexFormat(internalFormat, clientVersion);
+ DXGI_FORMAT srvFormat = gl_d3d11::GetSRVFormat(internalFormat, clientVersion);
+ DXGI_FORMAT rtvFormat = gl_d3d11::GetRTVFormat(internalFormat, clientVersion);
+ DXGI_FORMAT dsvFormat = gl_d3d11::GetDSVFormat(internalFormat, clientVersion);
+
+ DXGI_FORMAT multisampleFormat = (dsvFormat != DXGI_FORMAT_UNKNOWN ? dsvFormat : rtvFormat);
+ int supportedSamples = mRenderer->getNearestSupportedSamples(multisampleFormat, samples);
</ins><span class="cx"> if (supportedSamples < 0)
</span><span class="cx"> {
</span><span class="cx"> gl::error(GL_OUT_OF_MEMORY);
</span><span class="lines">@@ -214,16 +301,20 @@
</span><span class="cx"> desc.Height = height;
</span><span class="cx"> desc.MipLevels = 1;
</span><span class="cx"> desc.ArraySize = 1;
</span><del>- desc.Format = requestedFormat;
</del><ins>+ desc.Format = texFormat;
</ins><span class="cx"> desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
</span><span class="cx"> desc.SampleDesc.Quality = 0;
</span><span class="cx"> desc.Usage = D3D11_USAGE_DEFAULT;
</span><span class="cx"> desc.CPUAccessFlags = 0;
</span><span class="cx"> desc.MiscFlags = 0;
</span><del>- desc.BindFlags = (depth ? D3D11_BIND_DEPTH_STENCIL : (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE));
</del><ins>+ desc.BindFlags = ((srvFormat != DXGI_FORMAT_UNKNOWN) ? D3D11_BIND_SHADER_RESOURCE : 0) |
+ ((dsvFormat != DXGI_FORMAT_UNKNOWN) ? D3D11_BIND_DEPTH_STENCIL : 0) |
+ ((rtvFormat != DXGI_FORMAT_UNKNOWN) ? D3D11_BIND_RENDER_TARGET : 0);
</ins><span class="cx">
</span><span class="cx"> ID3D11Device *device = mRenderer->getDevice();
</span><del>- HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
</del><ins>+ ID3D11Texture2D *texture = NULL;
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &texture);
+ mTexture = texture;
</ins><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><span class="lines">@@ -232,10 +323,28 @@
</span><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- if (depth)
</del><ins>+ if (srvFormat != DXGI_FORMAT_UNKNOWN)
</ins><span class="cx"> {
</span><ins>+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = srvFormat;
+ srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ srvDesc.Texture2D.MostDetailedMip = 0;
+ srvDesc.Texture2D.MipLevels = 1;
+ result = device->CreateShaderResourceView(mTexture, &srvDesc, &mShaderResource);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(mTexture);
+ gl::error(GL_OUT_OF_MEMORY);
+ return;
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ if (dsvFormat != DXGI_FORMAT_UNKNOWN)
+ {
</ins><span class="cx"> D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
</span><del>- dsvDesc.Format = requestedFormat;
</del><ins>+ dsvDesc.Format = dsvFormat;
</ins><span class="cx"> dsvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_DSV_DIMENSION_TEXTURE2D : D3D11_DSV_DIMENSION_TEXTURE2DMS;
</span><span class="cx"> dsvDesc.Texture2D.MipSlice = 0;
</span><span class="cx"> dsvDesc.Flags = 0;
</span><span class="lines">@@ -243,82 +352,57 @@
</span><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><del>- mTexture->Release();
- mTexture = NULL;
</del><ins>+ SafeRelease(mTexture);
+ SafeRelease(mShaderResource);
</ins><span class="cx"> gl::error(GL_OUT_OF_MEMORY);
</span><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> }
</span><del>- else
</del><ins>+
+ if (rtvFormat != DXGI_FORMAT_UNKNOWN)
</ins><span class="cx"> {
</span><span class="cx"> D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
</span><del>- rtvDesc.Format = requestedFormat;
</del><ins>+ rtvDesc.Format = rtvFormat;
</ins><span class="cx"> rtvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_RTV_DIMENSION_TEXTURE2D : D3D11_RTV_DIMENSION_TEXTURE2DMS;
</span><span class="cx"> rtvDesc.Texture2D.MipSlice = 0;
</span><span class="cx"> result = device->CreateRenderTargetView(mTexture, &rtvDesc, &mRenderTarget);
</span><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><del>- mTexture->Release();
- mTexture = NULL;
</del><ins>+ SafeRelease(mTexture);
+ SafeRelease(mShaderResource);
+ SafeRelease(mDepthStencil);
</ins><span class="cx"> gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = requestedFormat;
- srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
- srvDesc.Texture2D.MostDetailedMip = 0;
- srvDesc.Texture2D.MipLevels = 1;
- result = device->CreateShaderResourceView(mTexture, &srvDesc, &mShaderResource);
</del><ins>+ if (gl_d3d11::RequiresTextureDataInitialization(internalFormat))
+ {
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
</ins><span class="cx">
</span><del>- if (result == E_OUTOFMEMORY)
- {
- mTexture->Release();
- mTexture = NULL;
- mRenderTarget->Release();
- mRenderTarget = NULL;
- gl::error(GL_OUT_OF_MEMORY);
- return;
</del><ins>+ const float clearValues[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ context->ClearRenderTargetView(mRenderTarget, clearValues);
</ins><span class="cx"> }
</span><del>- ASSERT(SUCCEEDED(result));
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mWidth = width;
</span><span class="cx"> mHeight = height;
</span><del>- mInternalFormat = format;
</del><ins>+ mDepth = 1;
+ mInternalFormat = internalFormat;
</ins><span class="cx"> mSamples = supportedSamples;
</span><del>- mActualFormat = d3d11_gl::ConvertTextureInternalFormat(requestedFormat);
</del><ins>+ mActualFormat = d3d11_gl::GetInternalFormat(texFormat, renderer->getCurrentClientVersion());
</ins><span class="cx"> mSubresourceIndex = D3D11CalcSubresource(0, 0, 1);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderTarget11::~RenderTarget11()
</span><span class="cx"> {
</span><del>- if (mTexture)
- {
- mTexture->Release();
- mTexture = NULL;
- }
-
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
-
- if (mDepthStencil)
- {
- mDepthStencil->Release();
- mDepthStencil = NULL;
- }
-
- if (mShaderResource)
- {
- mShaderResource->Release();
- mShaderResource = NULL;
- }
</del><ins>+ SafeRelease(mTexture);
+ SafeRelease(mRenderTarget);
+ SafeRelease(mDepthStencil);
+ SafeRelease(mShaderResource);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderTarget11 *RenderTarget11::makeRenderTarget11(RenderTarget *target)
</span><span class="lines">@@ -327,8 +411,13 @@
</span><span class="cx"> return static_cast<rx::RenderTarget11*>(target);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ID3D11Texture2D *RenderTarget11::getTexture() const
</del><ins>+void RenderTarget11::invalidate(GLint x, GLint y, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><ins>+ // Currently a no-op
+}
+
+ID3D11Resource *RenderTarget11::getTexture() const
+{
</ins><span class="cx"> return mTexture;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11RenderTarget11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/RenderTarget11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -20,14 +20,17 @@
</span><span class="cx"> class RenderTarget11 : public RenderTarget
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height);
- RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Texture2D *tex, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height);
- RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples, bool depth);
</del><ins>+ // RenderTarget11 takes ownership of any D3D11 resources it is given and will AddRef them
+ RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth);
+ RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth);
+ RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples);
</ins><span class="cx"> virtual ~RenderTarget11();
</span><span class="cx">
</span><span class="cx"> static RenderTarget11 *makeRenderTarget11(RenderTarget *renderTarget);
</span><span class="cx">
</span><del>- ID3D11Texture2D *getTexture() const;
</del><ins>+ virtual void invalidate(GLint x, GLint y, GLsizei width, GLsizei height);
+
+ ID3D11Resource *getTexture() const;
</ins><span class="cx"> ID3D11RenderTargetView *getRenderTargetView() const;
</span><span class="cx"> ID3D11DepthStencilView *getDepthStencilView() const;
</span><span class="cx"> ID3D11ShaderResourceView *getShaderResourceView() const;
</span><span class="lines">@@ -38,7 +41,7 @@
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(RenderTarget11);
</span><span class="cx">
</span><span class="cx"> unsigned int mSubresourceIndex;
</span><del>- ID3D11Texture2D *mTexture;
</del><ins>+ ID3D11Resource *mTexture;
</ins><span class="cx"> ID3D11RenderTargetView *mRenderTarget;
</span><span class="cx"> ID3D11DepthStencilView *mDepthStencil;
</span><span class="cx"> ID3D11ShaderResourceView *mShaderResource;
</span><span class="lines">@@ -48,4 +51,4 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#endif LIBGLESV2_RENDERER_RENDERTARGET11_H_
</del><span class="cx">\ No newline at end of file
</span><ins>+#endif LIBGLESV2_RENDERER_RENDERTARGET11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Renderer11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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">@@ -8,14 +8,15 @@
</span><span class="cx"> // Renderer11.cpp: Implements a back-end specific class for the D3D11 renderer.
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/main.h"
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
</ins><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx"> #include "libGLESv2/ProgramBinary.h"
</span><span class="cx"> #include "libGLESv2/Framebuffer.h"
</span><del>-#include "libGLESv2/Renderbuffer.h"
</del><ins>+#include "libGLESv2/RenderBuffer.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d11/Renderer11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/RenderTarget11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/SwapChain11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Image11.h"
</span><span class="lines">@@ -27,17 +28,9 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/TextureStorage11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Query11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Fence11.h"
</span><del>-
-#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba11ps.h"
-#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgb11ps.h"
-#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlum11ps.h"
-#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughlumalpha11ps.h"
-
-#include "libGLESv2/renderer/d3d11/shaders/compiled/clear11vs.h"
-#include "libGLESv2/renderer/d3d11/shaders/compiled/clearsingle11ps.h"
-#include "libGLESv2/renderer/d3d11/shaders/compiled/clearmultiple11ps.h"
-
</del><ins>+#include "libGLESv2/renderer/d3d11/Blit11.h"
+#include "libGLESv2/renderer/d3d11/Clear11.h"
+#include "libGLESv2/renderer/d3d11/PixelTransfer11.h"
</ins><span class="cx"> #include "libEGL/Display.h"
</span><span class="cx">
</span><span class="cx"> // Enable ANGLE_SKIP_DXGI_1_2_CHECK if there is not a possibility of using cross-process
</span><span class="lines">@@ -80,24 +73,10 @@
</span><span class="cx"> mLineLoopIB = NULL;
</span><span class="cx"> mTriangleFanIB = NULL;
</span><span class="cx">
</span><del>- mCopyResourcesInitialized = false;
- mCopyVB = NULL;
- mCopySampler = NULL;
- mCopyIL = NULL;
- mCopyVS = NULL;
- mCopyRGBAPS = NULL;
- mCopyRGBPS = NULL;
- mCopyLumPS = NULL;
- mCopyLumAlphaPS = NULL;
</del><ins>+ mBlit = NULL;
+ mPixelTransfer = NULL;
</ins><span class="cx">
</span><del>- mClearResourcesInitialized = false;
- mClearVB = NULL;
- mClearIL = NULL;
- mClearVS = NULL;
- mClearSinglePS = NULL;
- mClearMultiplePS = NULL;
- mClearScissorRS = NULL;
- mClearNoScissorRS = NULL;
</del><ins>+ mClear = NULL;
</ins><span class="cx">
</span><span class="cx"> mSyncQuery = NULL;
</span><span class="cx">
</span><span class="lines">@@ -118,7 +97,10 @@
</span><span class="cx">
</span><span class="cx"> mBGRATextureSupport = false;
</span><span class="cx">
</span><del>- mIsGeometryShaderActive = false;
</del><ins>+ mAppliedVertexShader = NULL;
+ mAppliedGeometryShader = NULL;
+ mCurPointGeometryShader = NULL;
+ mAppliedPixelShader = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderer11::~Renderer11()
</span><span class="lines">@@ -138,7 +120,7 @@
</span><span class="cx">
</span><span class="cx"> EGLint Renderer11::initialize()
</span><span class="cx"> {
</span><del>- if (!initializeCompiler())
</del><ins>+ if (!mCompiler.initialize())
</ins><span class="cx"> {
</span><span class="cx"> return EGL_NOT_INITIALIZED;
</span><span class="cx"> }
</span><span class="lines">@@ -256,7 +238,7 @@
</span><span class="cx"> return EGL_NOT_INITIALIZED;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- dxgiDevice->Release();
</del><ins>+ SafeRelease(dxgiDevice);
</ins><span class="cx">
</span><span class="cx"> mDxgiAdapter->GetDesc(&mAdapterDescription);
</span><span class="cx"> memset(mDescription, 0, sizeof(mDescription));
</span><span class="lines">@@ -287,43 +269,19 @@
</span><span class="cx"> filter.DenyList.pIDList = hideMessages;
</span><span class="cx">
</span><span class="cx"> infoQueue->AddStorageFilterEntries(&filter);
</span><del>-
- infoQueue->Release();
</del><ins>+ SafeRelease(infoQueue);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- unsigned int maxSupportedSamples = 0;
- unsigned int rtFormatCount = ArraySize(RenderTargetFormats);
- unsigned int dsFormatCount = ArraySize(DepthStencilFormats);
- for (unsigned int i = 0; i < rtFormatCount + dsFormatCount; ++i)
</del><ins>+ mMaxSupportedSamples = 0;
+
+ const d3d11::DXGIFormatSet &dxgiFormats = d3d11::GetAllUsedDXGIFormats();
+ for (d3d11::DXGIFormatSet::const_iterator i = dxgiFormats.begin(); i != dxgiFormats.end(); ++i)
</ins><span class="cx"> {
</span><del>- DXGI_FORMAT format = (i < rtFormatCount) ? RenderTargetFormats[i] : DepthStencilFormats[i - rtFormatCount];
- if (format != DXGI_FORMAT_UNKNOWN)
- {
- UINT formatSupport;
- result = mDevice->CheckFormatSupport(format, &formatSupport);
- if (SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET))
- {
- MultisampleSupportInfo supportInfo;
-
- for (unsigned int j = 1; j <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; j++)
- {
- result = mDevice->CheckMultisampleQualityLevels(format, j, &supportInfo.qualityLevels[j - 1]);
- if (SUCCEEDED(result) && supportInfo.qualityLevels[j - 1] > 0)
- {
- maxSupportedSamples = std::max(j, maxSupportedSamples);
- }
- else
- {
- supportInfo.qualityLevels[j - 1] = 0;
- }
- }
-
- mMultisampleSupportMap.insert(std::make_pair(format, supportInfo));
- }
- }
</del><ins>+ MultisampleSupportInfo support = getMultisampleSupportInfo(*i);
+ mMultisampleSupportMap.insert(std::make_pair(*i, support));
+ mMaxSupportedSamples = std::max(mMaxSupportedSamples, support.maxSupportedSamples);
</ins><span class="cx"> }
</span><del>- mMaxSupportedSamples = maxSupportedSamples;
</del><span class="cx">
</span><span class="cx"> initializeDevice();
</span><span class="cx">
</span><span class="lines">@@ -397,6 +355,31 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ DXGI_FORMAT rgTextureFormats[] =
+ {
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32G32_FLOAT,
+ };
+
+ mRGTextureSupport = true;
+ for (unsigned int i = 0; i < ArraySize(rgTextureFormats); i++)
+ {
+ if (SUCCEEDED(mDevice->CheckFormatSupport(rgTextureFormats[i], &formatSupport)))
+ {
+ mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredTextureFlags) == requiredTextureFlags;
+ mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredFilterFlags) == requiredFilterFlags;
+ mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredRenderableFlags) == requiredRenderableFlags;
+ }
+ else
+ {
+ mRGTextureSupport = false;
+ }
+ }
+
</ins><span class="cx"> // Check compressed texture support
</span><span class="cx"> const unsigned int requiredCompressedTextureFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D;
</span><span class="cx">
</span><span class="lines">@@ -465,6 +448,15 @@
</span><span class="cx"> mVertexDataManager = new VertexDataManager(this);
</span><span class="cx"> mIndexDataManager = new IndexDataManager(this);
</span><span class="cx">
</span><ins>+ ASSERT(!mBlit);
+ mBlit = new Blit11(this);
+
+ ASSERT(!mClear);
+ mClear = new Clear11(this);
+
+ ASSERT(!mPixelTransfer);
+ mPixelTransfer = new PixelTransfer11(this);
+
</ins><span class="cx"> markAllStateDirty();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -492,18 +484,23 @@
</span><span class="cx">
</span><span class="cx"> if (depthStencilFormat != DXGI_FORMAT_UNKNOWN)
</span><span class="cx"> {
</span><del>- UINT formatSupport = 0;
- result = mDevice->CheckFormatSupport(depthStencilFormat, &formatSupport);
- depthStencilFormatOK = SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL);
</del><ins>+ UINT depthStencilSupport = 0;
+ result = mDevice->CheckFormatSupport(depthStencilFormat, &depthStencilSupport);
+ depthStencilFormatOK = SUCCEEDED(result) && (depthStencilSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (depthStencilFormatOK)
</span><span class="cx"> {
</span><ins>+ // FIXME: parse types from context version
+ ASSERT(d3d11_gl::GetInternalFormat(renderTargetFormat, 2) == d3d11_gl::GetInternalFormat(renderTargetFormat, 3));
+ ASSERT(d3d11_gl::GetInternalFormat(depthStencilFormat, 2) == d3d11_gl::GetInternalFormat(depthStencilFormat, 3));
+
</ins><span class="cx"> ConfigDesc newConfig;
</span><del>- newConfig.renderTargetFormat = d3d11_gl::ConvertBackBufferFormat(renderTargetFormat);
- newConfig.depthStencilFormat = d3d11_gl::ConvertDepthStencilFormat(depthStencilFormat);
</del><ins>+ newConfig.renderTargetFormat = d3d11_gl::GetInternalFormat(renderTargetFormat, getCurrentClientVersion());
+ newConfig.depthStencilFormat = d3d11_gl::GetInternalFormat(depthStencilFormat, getCurrentClientVersion());
</ins><span class="cx"> newConfig.multiSample = 0; // FIXME: enumerate multi-sampling
</span><span class="cx"> newConfig.fastConfig = true; // Assume all DX11 format conversions to be fast
</span><ins>+ newConfig.es3Capable = true;
</ins><span class="cx">
</span><span class="cx"> (*configDescList)[numConfigs++] = newConfig;
</span><span class="cx"> }
</span><span class="lines">@@ -563,6 +560,21 @@
</span><span class="cx"> return new rx::SwapChain11(this, window, shareHandle, backBufferFormat, depthBufferFormat);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Renderer11::generateSwizzle(gl::Texture *texture)
+{
+ if (texture)
+ {
+ TextureStorageInterface *texStorage = texture->getNativeTexture();
+ if (texStorage)
+ {
+ TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(texStorage->getStorageInstance());
+
+ storage11->generateSwizzles(texture->getSwizzleRed(), texture->getSwizzleGreen(), texture->getSwizzleBlue(),
+ texture->getSwizzleAlpha());
+ }
+ }
+}
+
</ins><span class="cx"> void Renderer11::setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &samplerState)
</span><span class="cx"> {
</span><span class="cx"> if (type == gl::SAMPLER_PIXEL)
</span><span class="lines">@@ -621,7 +633,6 @@
</span><span class="cx"> void Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *texture)
</span><span class="cx"> {
</span><span class="cx"> ID3D11ShaderResourceView *textureSRV = NULL;
</span><del>- unsigned int serial = 0;
</del><span class="cx"> bool forceSetTexture = false;
</span><span class="cx">
</span><span class="cx"> if (texture)
</span><span class="lines">@@ -630,14 +641,15 @@
</span><span class="cx"> if (texStorage)
</span><span class="cx"> {
</span><span class="cx"> TextureStorage11 *storage11 = TextureStorage11::makeTextureStorage11(texStorage->getStorageInstance());
</span><del>- textureSRV = storage11->getSRV();
</del><ins>+ gl::SamplerState samplerState;
+ texture->getSamplerState(&samplerState);
+ textureSRV = storage11->getSRV(samplerState);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If we get NULL back from getSRV here, something went wrong in the texture class and we're unexpectedly
</span><span class="cx"> // missing the shader resource view
</span><span class="cx"> ASSERT(textureSRV != NULL);
</span><span class="cx">
</span><del>- serial = texture->getTextureSerial();
</del><span class="cx"> forceSetTexture = texture->hasDirtyImages();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -649,12 +661,12 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (forceSetTexture || mCurPixelTextureSerials[index] != serial)
</del><ins>+ if (forceSetTexture || mCurPixelSRVs[index] != textureSRV)
</ins><span class="cx"> {
</span><span class="cx"> mDeviceContext->PSSetShaderResources(index, 1, &textureSRV);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mCurPixelTextureSerials[index] = serial;
</del><ins>+ mCurPixelSRVs[index] = textureSRV;
</ins><span class="cx"> }
</span><span class="cx"> else if (type == gl::SAMPLER_VERTEX)
</span><span class="cx"> {
</span><span class="lines">@@ -664,16 +676,65 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (forceSetTexture || mCurVertexTextureSerials[index] != serial)
</del><ins>+ if (forceSetTexture || mCurVertexSRVs[index] != textureSRV)
</ins><span class="cx"> {
</span><span class="cx"> mDeviceContext->VSSetShaderResources(index, 1, &textureSRV);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mCurVertexTextureSerials[index] = serial;
</del><ins>+ mCurVertexSRVs[index] = textureSRV;
</ins><span class="cx"> }
</span><span class="cx"> else UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer11::setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[])
+{
+ for (unsigned int uniformBufferIndex = 0; uniformBufferIndex < gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; uniformBufferIndex++)
+ {
+ const gl::Buffer *uniformBuffer = vertexUniformBuffers[uniformBufferIndex];
+ if (uniformBuffer)
+ {
+ BufferStorage11 *bufferStorage = BufferStorage11::makeBufferStorage11(uniformBuffer->getStorage());
+ ID3D11Buffer *constantBuffer = bufferStorage->getBuffer(BUFFER_USAGE_UNIFORM);
+
+ if (!constantBuffer)
+ {
+ return false;
+ }
+
+ if (mCurrentConstantBufferVS[uniformBufferIndex] != bufferStorage->getSerial())
+ {
+ mDeviceContext->VSSetConstantBuffers(getReservedVertexUniformBuffers() + uniformBufferIndex,
+ 1, &constantBuffer);
+ mCurrentConstantBufferVS[uniformBufferIndex] = bufferStorage->getSerial();
+ }
+ }
+ }
+
+ for (unsigned int uniformBufferIndex = 0; uniformBufferIndex < gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS; uniformBufferIndex++)
+ {
+ const gl::Buffer *uniformBuffer = fragmentUniformBuffers[uniformBufferIndex];
+ if (uniformBuffer)
+ {
+ BufferStorage11 *bufferStorage = BufferStorage11::makeBufferStorage11(uniformBuffer->getStorage());
+ ID3D11Buffer *constantBuffer = bufferStorage->getBuffer(BUFFER_USAGE_UNIFORM);
+
+ if (!constantBuffer)
+ {
+ return false;
+ }
+
+ if (mCurrentConstantBufferPS[uniformBufferIndex] != bufferStorage->getSerial())
+ {
+ mDeviceContext->PSSetConstantBuffers(getReservedFragmentUniformBuffers() + uniformBufferIndex,
+ 1, &constantBuffer);
+ mCurrentConstantBufferPS[uniformBufferIndex] = bufferStorage->getSerial();
+ }
+ }
+ }
+
+ return true;
+}
+
</ins><span class="cx"> void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState)
</span><span class="cx"> {
</span><span class="cx"> if (mForceSetRasterState || memcmp(&rasterState, &mCurRasterState, sizeof(gl::RasterizerState)) != 0)
</span><span class="lines">@@ -694,12 +755,12 @@
</span><span class="cx"> mForceSetRasterState = false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer11::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
</del><ins>+void Renderer11::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
</ins><span class="cx"> unsigned int sampleMask)
</span><span class="cx"> {
</span><span class="cx"> if (mForceSetBlendState ||
</span><span class="cx"> memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0 ||
</span><del>- memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0 ||
</del><ins>+ memcmp(&blendColor, &mCurBlendColor, sizeof(gl::ColorF)) != 0 ||
</ins><span class="cx"> sampleMask != mCurSampleMask)
</span><span class="cx"> {
</span><span class="cx"> ID3D11BlendState *dxBlendState = mStateCache.getBlendState(framebuffer, blendState);
</span><span class="lines">@@ -759,8 +820,14 @@
</span><span class="cx"> "setting the default depth stencil state.");
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mDeviceContext->OMSetDepthStencilState(dxDepthStencilState, static_cast<UINT>(stencilRef));
</del><ins>+ // 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
+ META_ASSERT(D3D11_DEFAULT_STENCIL_READ_MASK == 0xFF);
+ META_ASSERT(D3D11_DEFAULT_STENCIL_WRITE_MASK == 0xFF);
+ UINT dxStencilRef = std::min<UINT>(stencilRef, 0xFFu);
</ins><span class="cx">
</span><ins>+ mDeviceContext->OMSetDepthStencilState(dxDepthStencilState, dxStencilRef);
+
</ins><span class="cx"> mCurDepthStencilState = depthStencilState;
</span><span class="cx"> mCurStencilRef = stencilRef;
</span><span class="cx"> mCurStencilBackRef = stencilBackRef;
</span><span class="lines">@@ -954,24 +1021,8 @@
</span><span class="cx"> missingColorRenderTarget = false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#ifdef _DEBUG
- // Workaround for Debug SETSHADERRESOURCES_HAZARD D3D11 warnings
- for (unsigned int vertexSerialIndex = 0; vertexSerialIndex < gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; vertexSerialIndex++)
- {
- if (colorbuffer->getTextureSerial() != 0 && mCurVertexTextureSerials[vertexSerialIndex] == colorbuffer->getTextureSerial())
- {
- setTexture(gl::SAMPLER_VERTEX, vertexSerialIndex, NULL);
- }
- }
-
- for (unsigned int pixelSerialIndex = 0; pixelSerialIndex < gl::MAX_TEXTURE_IMAGE_UNITS; pixelSerialIndex++)
- {
- if (colorbuffer->getTextureSerial() != 0 && mCurPixelTextureSerials[pixelSerialIndex] == colorbuffer->getTextureSerial())
- {
- setTexture(gl::SAMPLER_PIXEL, pixelSerialIndex, NULL);
- }
- }
-#endif
</del><ins>+ // TODO: Detect if this color buffer is already bound as a texture and unbind it first to prevent
+ // D3D11 warnings.
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1052,6 +1103,7 @@
</span><span class="cx"> mRenderTargetDesc.format = renderTargetFormat;
</span><span class="cx"> mForceSetViewport = true;
</span><span class="cx"> mForceSetScissor = true;
</span><ins>+ mForceSetBlendState = true;
</ins><span class="cx">
</span><span class="cx"> if (!mDepthStencilInitialized || depthSize != mCurDepthSize)
</span><span class="cx"> {
</span><span class="lines">@@ -1071,13 +1123,16 @@
</span><span class="cx"> mDepthStencilInitialized = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ invalidateFramebufferSwizzles(framebuffer);
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances)
</del><ins>+GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances)
</ins><span class="cx"> {
</span><span class="cx"> TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
</span><del>- GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
</del><ins>+ GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, currentValues, programBinary, first, count, attributes, instances);
</ins><span class="cx"> if (err != GL_NO_ERROR)
</span><span class="cx"> {
</span><span class="cx"> return err;
</span><span class="lines">@@ -1092,28 +1147,27 @@
</span><span class="cx">
</span><span class="cx"> if (err == GL_NO_ERROR)
</span><span class="cx"> {
</span><ins>+ IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
+
+ ID3D11Buffer *buffer = NULL;
+ DXGI_FORMAT bufferFormat = indexBuffer->getIndexFormat();
+
</ins><span class="cx"> if (indexInfo->storage)
</span><span class="cx"> {
</span><del>- if (indexInfo->serial != mAppliedStorageIBSerial || indexInfo->startOffset != mAppliedIBOffset)
- {
- BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(indexInfo->storage);
- IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
-
- mDeviceContext->IASetIndexBuffer(storage->getBuffer(BUFFER_USAGE_INDEX), indexBuffer->getIndexFormat(), indexInfo->startOffset);
-
- mAppliedIBSerial = 0;
- mAppliedStorageIBSerial = storage->getSerial();
- mAppliedIBOffset = indexInfo->startOffset;
- }
</del><ins>+ BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(indexInfo->storage);
+ buffer = storage->getBuffer(BUFFER_USAGE_INDEX);
</ins><span class="cx"> }
</span><del>- else if (indexInfo->serial != mAppliedIBSerial || indexInfo->startOffset != mAppliedIBOffset)
</del><ins>+ else
</ins><span class="cx"> {
</span><del>- IndexBuffer11* indexBuffer = IndexBuffer11::makeIndexBuffer11(indexInfo->indexBuffer);
</del><ins>+ buffer = indexBuffer->getBuffer();
+ }
</ins><span class="cx">
</span><del>- mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexInfo->startOffset);
</del><ins>+ if (buffer != mAppliedIB || bufferFormat != mAppliedIBFormat || indexInfo->startOffset != mAppliedIBOffset)
+ {
+ mDeviceContext->IASetIndexBuffer(buffer, bufferFormat, indexInfo->startOffset);
</ins><span class="cx">
</span><del>- mAppliedIBSerial = indexInfo->serial;
- mAppliedStorageIBSerial = 0;
</del><ins>+ mAppliedIB = buffer;
+ mAppliedIBFormat = bufferFormat;
</ins><span class="cx"> mAppliedIBOffset = indexInfo->startOffset;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1121,10 +1175,80 @@
</span><span class="cx"> return err;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
</del><ins>+void Renderer11::applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[])
</ins><span class="cx"> {
</span><del>- if (mode == GL_LINE_LOOP)
</del><ins>+ ID3D11Buffer* d3dBuffers[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ UINT d3dOffsets[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ bool requiresUpdate = false;
+ for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
</ins><span class="cx"> {
</span><ins>+ if (transformFeedbackBuffers[i])
+ {
+ BufferStorage11 *storage = BufferStorage11::makeBufferStorage11(transformFeedbackBuffers[i]->getStorage());
+ ID3D11Buffer *buffer = storage->getBuffer(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+
+ d3dBuffers[i] = buffer;
+ d3dOffsets[i] = (mAppliedTFBuffers[i] != buffer) ? static_cast<UINT>(offsets[i]) : -1;
+ }
+ else
+ {
+ d3dBuffers[i] = NULL;
+ d3dOffsets[i] = 0;
+ }
+
+ if (d3dBuffers[i] != mAppliedTFBuffers[i] || offsets[i] != mAppliedTFOffsets[i])
+ {
+ requiresUpdate = true;
+ }
+ }
+
+ if (requiresUpdate)
+ {
+ mDeviceContext->SOSetTargets(ArraySize(d3dBuffers), d3dBuffers, d3dOffsets);
+ for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ mAppliedTFBuffers[i] = d3dBuffers[i];
+ mAppliedTFOffsets[i] = offsets[i];
+ }
+ }
+}
+
+void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive)
+{
+ if (mode == GL_POINTS && transformFeedbackActive)
+ {
+ // 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->PSSetShader(NULL, NULL, 0);
+
+ if (instances > 0)
+ {
+ mDeviceContext->DrawInstanced(count, instances, 0, 0);
+ }
+ else
+ {
+ mDeviceContext->Draw(count, 0);
+ }
+
+ mDeviceContext->GSSetShader(mCurPointGeometryShader, NULL, 0);
+ mDeviceContext->PSSetShader(mAppliedPixelShader, NULL, 0);
+
+ if (instances > 0)
+ {
+ mDeviceContext->DrawInstanced(count, instances, 0, 0);
+ }
+ else
+ {
+ mDeviceContext->Draw(count, 0);
+ }
+
+ mDeviceContext->GSSetShader(mAppliedGeometryShader, NULL, 0);
+ }
+ else if (mode == GL_LINE_LOOP)
+ {
</ins><span class="cx"> drawLineLoop(count, GL_NONE, NULL, 0, NULL);
</span><span class="cx"> }
</span><span class="cx"> else if (mode == GL_TRIANGLE_FAN)
</span><span class="lines">@@ -1141,7 +1265,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances)
</del><ins>+void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances)
</ins><span class="cx"> {
</span><span class="cx"> if (mode == GL_LINE_LOOP)
</span><span class="cx"> {
</span><span class="lines">@@ -1251,13 +1376,15 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mAppliedIBSerial != mLineLoopIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
</del><ins>+ IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
+ ID3D11Buffer *d3dIndexBuffer = indexBuffer->getBuffer();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+
+ if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat || mAppliedIBOffset != indexBufferOffset)
</ins><span class="cx"> {
</span><del>- IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mLineLoopIB->getIndexBuffer());
-
</del><span class="cx"> mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
</span><del>- mAppliedIBSerial = mLineLoopIB->getSerial();
- mAppliedStorageIBSerial = 0;
</del><ins>+ mAppliedIB = d3dIndexBuffer;
+ mAppliedIBFormat = indexFormat;
</ins><span class="cx"> mAppliedIBOffset = indexBufferOffset;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1360,13 +1487,15 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mAppliedIBSerial != mTriangleFanIB->getSerial() || mAppliedIBOffset != indexBufferOffset)
</del><ins>+ IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mTriangleFanIB->getIndexBuffer());
+ ID3D11Buffer *d3dIndexBuffer = indexBuffer->getBuffer();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+
+ if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat || mAppliedIBOffset != indexBufferOffset)
</ins><span class="cx"> {
</span><del>- IndexBuffer11 *indexBuffer = IndexBuffer11::makeIndexBuffer11(mTriangleFanIB->getIndexBuffer());
-
</del><span class="cx"> mDeviceContext->IASetIndexBuffer(indexBuffer->getBuffer(), indexBuffer->getIndexFormat(), indexBufferOffset);
</span><del>- mAppliedIBSerial = mTriangleFanIB->getSerial();
- mAppliedStorageIBSerial = 0;
</del><ins>+ mAppliedIB = d3dIndexBuffer;
+ mAppliedIBFormat = indexFormat;
</ins><span class="cx"> mAppliedIBOffset = indexBufferOffset;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1380,54 +1509,72 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer11::applyShaders(gl::ProgramBinary *programBinary)
</del><ins>+void Renderer11::applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[])
</ins><span class="cx"> {
</span><del>- unsigned int programBinarySerial = programBinary->getSerial();
- const bool updateProgramState = (programBinarySerial != mAppliedProgramBinarySerial);
</del><ins>+ ShaderExecutable *vertexExe = programBinary->getVertexExecutableForInputLayout(inputLayout);
+ ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
+ ShaderExecutable *geometryExe = programBinary->getGeometryExecutable();
</ins><span class="cx">
</span><del>- if (updateProgramState)
</del><ins>+ ID3D11VertexShader *vertexShader = (vertexExe ? ShaderExecutable11::makeShaderExecutable11(vertexExe)->getVertexShader() : NULL);
+
+ ID3D11PixelShader *pixelShader = NULL;
+ // Skip pixel shader if we're doing rasterizer discard.
+ if (!rasterizerDiscard)
</ins><span class="cx"> {
</span><del>- ShaderExecutable *vertexExe = programBinary->getVertexExecutable();
- ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
</del><ins>+ pixelShader = (pixelExe ? ShaderExecutable11::makeShaderExecutable11(pixelExe)->getPixelShader() : NULL);
+ }
</ins><span class="cx">
</span><del>- ID3D11VertexShader *vertexShader = NULL;
- if (vertexExe) vertexShader = ShaderExecutable11::makeShaderExecutable11(vertexExe)->getVertexShader();
</del><ins>+ ID3D11GeometryShader *geometryShader = NULL;
+ if (transformFeedbackActive)
+ {
+ geometryShader = (vertexExe ? ShaderExecutable11::makeShaderExecutable11(vertexExe)->getStreamOutShader() : NULL);
+ }
+ else if (mCurRasterState.pointDrawMode)
+ {
+ geometryShader = (geometryExe ? ShaderExecutable11::makeShaderExecutable11(geometryExe)->getGeometryShader() : NULL);
+ }
</ins><span class="cx">
</span><del>- ID3D11PixelShader *pixelShader = NULL;
- if (pixelExe) pixelShader = ShaderExecutable11::makeShaderExecutable11(pixelExe)->getPixelShader();
</del><ins>+ bool dirtyUniforms = false;
</ins><span class="cx">
</span><del>- mDeviceContext->PSSetShader(pixelShader, NULL, 0);
</del><ins>+ if (vertexShader != mAppliedVertexShader)
+ {
</ins><span class="cx"> mDeviceContext->VSSetShader(vertexShader, NULL, 0);
</span><ins>+ mAppliedVertexShader = vertexShader;
+ dirtyUniforms = true;
+ }
</ins><span class="cx">
</span><del>- programBinary->dirtyAllUniforms();
</del><ins>+ if (geometryShader != mAppliedGeometryShader)
+ {
+ mDeviceContext->GSSetShader(geometryShader, NULL, 0);
+ mAppliedGeometryShader = geometryShader;
+ dirtyUniforms = true;
+ }
</ins><span class="cx">
</span><del>- mAppliedProgramBinarySerial = programBinarySerial;
</del><ins>+ if (geometryExe && mCurRasterState.pointDrawMode)
+ {
+ mCurPointGeometryShader = ShaderExecutable11::makeShaderExecutable11(geometryExe)->getGeometryShader();
</ins><span class="cx"> }
</span><ins>+ else
+ {
+ mCurPointGeometryShader = NULL;
+ }
</ins><span class="cx">
</span><del>- // Only use the geometry shader currently for point sprite drawing
- const bool usesGeometryShader = (programBinary->usesGeometryShader() && mCurRasterState.pointDrawMode);
</del><ins>+ if (pixelShader != mAppliedPixelShader)
+ {
+ mDeviceContext->PSSetShader(pixelShader, NULL, 0);
+ mAppliedPixelShader = pixelShader;
+ dirtyUniforms = true;
+ }
</ins><span class="cx">
</span><del>- if (updateProgramState || usesGeometryShader != mIsGeometryShaderActive)
</del><ins>+ if (dirtyUniforms)
</ins><span class="cx"> {
</span><del>- if (usesGeometryShader)
- {
- ShaderExecutable *geometryExe = programBinary->getGeometryExecutable();
- ID3D11GeometryShader *geometryShader = ShaderExecutable11::makeShaderExecutable11(geometryExe)->getGeometryShader();
- mDeviceContext->GSSetShader(geometryShader, NULL, 0);
- }
- else
- {
- mDeviceContext->GSSetShader(NULL, NULL, 0);
- }
-
- mIsGeometryShaderActive = usesGeometryShader;
</del><ins>+ programBinary->dirtyAllUniforms();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray)
</del><ins>+void Renderer11::applyUniforms(const gl::ProgramBinary &programBinary)
</ins><span class="cx"> {
</span><del>- ShaderExecutable11 *vertexExecutable = ShaderExecutable11::makeShaderExecutable11(programBinary->getVertexExecutable());
- ShaderExecutable11 *pixelExecutable = ShaderExecutable11::makeShaderExecutable11(programBinary->getPixelExecutable());
</del><ins>+ const std::vector<gl::LinkedUniform*> &uniformArray = programBinary.getUniforms();
</ins><span class="cx">
</span><span class="cx"> unsigned int totalRegisterCountVS = 0;
</span><span class="cx"> unsigned int totalRegisterCountPS = 0;
</span><span class="lines">@@ -1435,26 +1582,31 @@
</span><span class="cx"> bool vertexUniformsDirty = false;
</span><span class="cx"> bool pixelUniformsDirty = false;
</span><span class="cx">
</span><del>- for (gl::UniformArray::const_iterator uniform_iterator = uniformArray->begin(); uniform_iterator != uniformArray->end(); uniform_iterator++)
</del><ins>+ for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++)
</ins><span class="cx"> {
</span><del>- const gl::Uniform *uniform = *uniform_iterator;
</del><ins>+ const gl::LinkedUniform &uniform = *uniformArray[uniformIndex];
</ins><span class="cx">
</span><del>- if (uniform->vsRegisterIndex >= 0)
</del><ins>+ if (uniform.isReferencedByVertexShader() && !uniform.isSampler())
</ins><span class="cx"> {
</span><del>- totalRegisterCountVS += uniform->registerCount;
- vertexUniformsDirty = vertexUniformsDirty || uniform->dirty;
</del><ins>+ totalRegisterCountVS += uniform.registerCount;
+ vertexUniformsDirty = (vertexUniformsDirty || uniform.dirty);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (uniform->psRegisterIndex >= 0)
</del><ins>+ if (uniform.isReferencedByFragmentShader() && !uniform.isSampler())
</ins><span class="cx"> {
</span><del>- totalRegisterCountPS += uniform->registerCount;
- pixelUniformsDirty = pixelUniformsDirty || uniform->dirty;
</del><ins>+ totalRegisterCountPS += uniform.registerCount;
+ pixelUniformsDirty = (pixelUniformsDirty || uniform.dirty);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ID3D11Buffer *vertexConstantBuffer = vertexExecutable->getConstantBuffer(mDevice, totalRegisterCountVS);
- ID3D11Buffer *pixelConstantBuffer = pixelExecutable->getConstantBuffer(mDevice, totalRegisterCountPS);
</del><ins>+ const UniformStorage11 *vertexUniformStorage = UniformStorage11::makeUniformStorage11(&programBinary.getVertexUniformStorage());
+ const UniformStorage11 *fragmentUniformStorage = UniformStorage11::makeUniformStorage11(&programBinary.getFragmentUniformStorage());
+ ASSERT(vertexUniformStorage);
+ ASSERT(fragmentUniformStorage);
</ins><span class="cx">
</span><ins>+ ID3D11Buffer *vertexConstantBuffer = vertexUniformStorage->getConstantBuffer();
+ ID3D11Buffer *pixelConstantBuffer = fragmentUniformStorage->getConstantBuffer();
+
</ins><span class="cx"> float (*mapVS)[4] = NULL;
</span><span class="cx"> float (*mapPS)[4] = NULL;
</span><span class="cx">
</span><span class="lines">@@ -1474,24 +1626,27 @@
</span><span class="cx"> mapPS = (float(*)[4])map.pData;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (gl::UniformArray::iterator uniform_iterator = uniformArray->begin(); uniform_iterator != uniformArray->end(); uniform_iterator++)
</del><ins>+ for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++)
</ins><span class="cx"> {
</span><del>- gl::Uniform *uniform = *uniform_iterator;
</del><ins>+ gl::LinkedUniform *uniform = uniformArray[uniformIndex];
</ins><span class="cx">
</span><del>- if (uniform->type != GL_SAMPLER_2D && uniform->type != GL_SAMPLER_CUBE)
</del><ins>+ if (!uniform->isSampler())
</ins><span class="cx"> {
</span><del>- if (uniform->vsRegisterIndex >= 0 && mapVS)
</del><ins>+ unsigned int componentCount = (4 - uniform->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->isReferencedByVertexShader() && mapVS)
</ins><span class="cx"> {
</span><del>- memcpy(mapVS + uniform->vsRegisterIndex, uniform->data, uniform->registerCount * sizeof(float[4]));
</del><ins>+ memcpy(&mapVS[uniform->vsRegisterIndex][uniform->registerElement], uniform->data, uniform->registerCount * sizeof(float) * componentCount);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (uniform->psRegisterIndex >= 0 && mapPS)
</del><ins>+ if (uniform->isReferencedByFragmentShader() && mapPS)
</ins><span class="cx"> {
</span><del>- memcpy(mapPS + uniform->psRegisterIndex, uniform->data, uniform->registerCount * sizeof(float[4]));
</del><ins>+ memcpy(&mapPS[uniform->psRegisterIndex][uniform->registerElement], uniform->data, uniform->registerCount * sizeof(float) * componentCount);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>-
- uniform->dirty = false;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (mapVS)
</span><span class="lines">@@ -1571,273 +1726,10 @@
</span><span class="cx">
</span><span class="cx"> void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
</span><span class="cx"> {
</span><del>- gl::Renderbuffer *firstRenderbuffer = frameBuffer->getFirstColorbuffer();
- GLenum internalFormat = firstRenderbuffer ? firstRenderbuffer->getInternalFormat() : GL_NONE;
-
- bool needMaskedColorClear = (clearParams.mask & GL_COLOR_BUFFER_BIT) &&
- ((!clearParams.colorMaskRed && gl::GetRedSize(internalFormat) > 0) ||
- (!clearParams.colorMaskGreen && gl::GetGreenSize(internalFormat) > 0) ||
- (!clearParams.colorMaskBlue && gl::GetBlueSize(internalFormat) > 0) ||
- (!clearParams.colorMaskAlpha && gl::GetAlphaSize(internalFormat) > 0));
-
- unsigned int stencilUnmasked = 0x0;
- if (frameBuffer->hasStencil())
- {
- unsigned int stencilSize = gl::GetStencilSize(frameBuffer->getStencilbuffer()->getActualFormat());
- stencilUnmasked = (0x1 << stencilSize) - 1;
- }
- bool needMaskedStencilClear = (clearParams.mask & GL_STENCIL_BUFFER_BIT) &&
- (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
-
- bool needScissoredClear = mScissorEnabled && (mCurScissor.x > 0 || mCurScissor.y > 0 ||
- mCurScissor.x + mCurScissor.width < mRenderTargetDesc.width ||
- mCurScissor.y + mCurScissor.height < mRenderTargetDesc.height);
-
- if (needMaskedColorClear || needMaskedStencilClear || needScissoredClear)
- {
- maskedClear(clearParams, frameBuffer);
- }
- else
- {
- if (clearParams.mask & GL_COLOR_BUFFER_BIT)
- {
- for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
- {
- if (frameBuffer->isEnabledColorAttachment(colorAttachment))
- {
- gl::Renderbuffer *renderbufferObject = frameBuffer->getColorbuffer(colorAttachment);
- if (renderbufferObject)
- {
- RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(renderbufferObject->getRenderTarget());
- if (!renderTarget)
- {
- ERR("render target pointer unexpectedly null.");
- return;
- }
-
- ID3D11RenderTargetView *framebufferRTV = renderTarget->getRenderTargetView();
- if (!framebufferRTV)
- {
- ERR("render target view pointer unexpectedly null.");
- return;
- }
-
- GLenum format = renderbufferObject->getInternalFormat();
-
- const float clearValues[4] = { (gl::GetRedSize(format) > 0) ? clearParams.colorClearValue.red : 0.0f,
- (gl::GetGreenSize(format) > 0) ? clearParams.colorClearValue.green : 0.0f,
- (gl::GetBlueSize(format) > 0) ? clearParams.colorClearValue.blue : 0.0f,
- (gl::GetAlphaSize(format) > 0) ? clearParams.colorClearValue.alpha : 1.0f };
- mDeviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
- }
- }
- }
- }
- if (clearParams.mask & GL_DEPTH_BUFFER_BIT || clearParams.mask & GL_STENCIL_BUFFER_BIT)
- {
- gl::Renderbuffer *renderbufferObject = frameBuffer->getDepthOrStencilbuffer();
- if (renderbufferObject)
- {
- RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(renderbufferObject->getDepthStencil());
- if (!renderTarget)
- {
- ERR("render target pointer unexpectedly null.");
- return;
- }
-
- ID3D11DepthStencilView *framebufferDSV = renderTarget->getDepthStencilView();
- if (!framebufferDSV)
- {
- ERR("depth stencil view pointer unexpectedly null.");
- return;
- }
-
- UINT clearFlags = 0;
- if (clearParams.mask & GL_DEPTH_BUFFER_BIT)
- {
- clearFlags |= D3D11_CLEAR_DEPTH;
- }
- if (clearParams.mask & GL_STENCIL_BUFFER_BIT)
- {
- clearFlags |= D3D11_CLEAR_STENCIL;
- }
-
- float depthClear = gl::clamp01(clearParams.depthClearValue);
- UINT8 stencilClear = clearParams.stencilClearValue & 0x000000FF;
-
- mDeviceContext->ClearDepthStencilView(framebufferDSV, clearFlags, depthClear, stencilClear);
- }
- }
- }
</del><ins>+ mClear->clearFramebuffer(clearParams, frameBuffer);
+ invalidateFramebufferSwizzles(frameBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer11::maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
-{
- HRESULT result;
-
- if (!mClearResourcesInitialized)
- {
- ASSERT(!mClearVB && !mClearVS && !mClearSinglePS && !mClearMultiplePS && !mClearScissorRS && !mClearNoScissorRS);
-
- D3D11_BUFFER_DESC vbDesc;
- vbDesc.ByteWidth = sizeof(d3d11::PositionDepthColorVertex) * 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 = mDevice->CreateBuffer(&vbDesc, NULL, &mClearVB);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearVB, "Renderer11 masked clear vertex buffer");
-
- D3D11_INPUT_ELEMENT_DESC quadLayout[] =
- {
- { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- };
-
- result = mDevice->CreateInputLayout(quadLayout, 2, g_VS_Clear, sizeof(g_VS_Clear), &mClearIL);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearIL, "Renderer11 masked clear input layout");
-
- result = mDevice->CreateVertexShader(g_VS_Clear, sizeof(g_VS_Clear), NULL, &mClearVS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearVS, "Renderer11 masked clear vertex shader");
-
- result = mDevice->CreatePixelShader(g_PS_ClearSingle, sizeof(g_PS_ClearSingle), NULL, &mClearSinglePS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearSinglePS, "Renderer11 masked clear pixel shader (1 RT)");
-
- result = mDevice->CreatePixelShader(g_PS_ClearMultiple, sizeof(g_PS_ClearMultiple), NULL, &mClearMultiplePS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearMultiplePS, "Renderer11 masked clear pixel shader (MRT)");
-
- D3D11_RASTERIZER_DESC rsScissorDesc;
- rsScissorDesc.FillMode = D3D11_FILL_SOLID;
- rsScissorDesc.CullMode = D3D11_CULL_NONE;
- rsScissorDesc.FrontCounterClockwise = FALSE;
- rsScissorDesc.DepthBias = 0;
- rsScissorDesc.DepthBiasClamp = 0.0f;
- rsScissorDesc.SlopeScaledDepthBias = 0.0f;
- rsScissorDesc.DepthClipEnable = FALSE;
- rsScissorDesc.ScissorEnable = TRUE;
- rsScissorDesc.MultisampleEnable = FALSE;
- rsScissorDesc.AntialiasedLineEnable = FALSE;
-
- result = mDevice->CreateRasterizerState(&rsScissorDesc, &mClearScissorRS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearScissorRS, "Renderer11 masked clear scissor rasterizer state");
-
- D3D11_RASTERIZER_DESC rsNoScissorDesc;
- rsNoScissorDesc.FillMode = D3D11_FILL_SOLID;
- rsNoScissorDesc.CullMode = D3D11_CULL_NONE;
- rsNoScissorDesc.FrontCounterClockwise = FALSE;
- rsNoScissorDesc.DepthBias = 0;
- rsNoScissorDesc.DepthBiasClamp = 0.0f;
- rsNoScissorDesc.SlopeScaledDepthBias = 0.0f;
- rsNoScissorDesc.DepthClipEnable = FALSE;
- rsNoScissorDesc.ScissorEnable = FALSE;
- rsNoScissorDesc.MultisampleEnable = FALSE;
- rsNoScissorDesc.AntialiasedLineEnable = FALSE;
-
- result = mDevice->CreateRasterizerState(&rsNoScissorDesc, &mClearNoScissorRS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mClearNoScissorRS, "Renderer11 masked clear no scissor rasterizer state");
-
- mClearResourcesInitialized = true;
- }
-
- // Prepare the depth stencil state to write depth values if the depth should be cleared
- // and stencil values if the stencil should be cleared
- gl::DepthStencilState glDSState;
- glDSState.depthTest = (clearParams.mask & GL_DEPTH_BUFFER_BIT) != 0;
- glDSState.depthFunc = GL_ALWAYS;
- glDSState.depthMask = (clearParams.mask & GL_DEPTH_BUFFER_BIT) != 0;
- glDSState.stencilTest = (clearParams.mask & GL_STENCIL_BUFFER_BIT) != 0;
- glDSState.stencilFunc = GL_ALWAYS;
- glDSState.stencilMask = 0;
- glDSState.stencilFail = GL_REPLACE;
- glDSState.stencilPassDepthFail = GL_REPLACE;
- glDSState.stencilPassDepthPass = GL_REPLACE;
- glDSState.stencilWritemask = clearParams.stencilWriteMask;
- glDSState.stencilBackFunc = GL_ALWAYS;
- glDSState.stencilBackMask = 0;
- glDSState.stencilBackFail = GL_REPLACE;
- glDSState.stencilBackPassDepthFail = GL_REPLACE;
- glDSState.stencilBackPassDepthPass = GL_REPLACE;
- glDSState.stencilBackWritemask = clearParams.stencilWriteMask;
-
- int stencilClear = clearParams.stencilClearValue & 0x000000FF;
-
- ID3D11DepthStencilState *dsState = mStateCache.getDepthStencilState(glDSState);
-
- // Prepare the blend state to use a write mask if the color buffer should be cleared
- gl::BlendState glBlendState;
- glBlendState.blend = false;
- glBlendState.sourceBlendRGB = GL_ONE;
- glBlendState.destBlendRGB = GL_ZERO;
- glBlendState.sourceBlendAlpha = GL_ONE;
- glBlendState.destBlendAlpha = GL_ZERO;
- glBlendState.blendEquationRGB = GL_FUNC_ADD;
- glBlendState.blendEquationAlpha = GL_FUNC_ADD;
- glBlendState.colorMaskRed = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskRed : false;
- glBlendState.colorMaskGreen = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskGreen : false;
- glBlendState.colorMaskBlue = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskBlue : false;
- glBlendState.colorMaskAlpha = (clearParams.mask & GL_COLOR_BUFFER_BIT) ? clearParams.colorMaskAlpha : false;
- glBlendState.sampleAlphaToCoverage = false;
- glBlendState.dither = false;
-
- static const float blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
- static const UINT sampleMask = 0xFFFFFFFF;
-
- ID3D11BlendState *blendState = mStateCache.getBlendState(frameBuffer, glBlendState);
-
- // Set the vertices
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = mDeviceContext->Map(mClearVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- ERR("Failed to map masked clear vertex buffer, HRESULT: 0x%X.", result);
- return;
- }
-
- d3d11::PositionDepthColorVertex *vertices = reinterpret_cast<d3d11::PositionDepthColorVertex*>(mappedResource.pData);
-
- float depthClear = gl::clamp01(clearParams.depthClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[0], -1.0f, 1.0f, depthClear, clearParams.colorClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[1], -1.0f, -1.0f, depthClear, clearParams.colorClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[2], 1.0f, 1.0f, depthClear, clearParams.colorClearValue);
- d3d11::SetPositionDepthColorVertex(&vertices[3], 1.0f, -1.0f, depthClear, clearParams.colorClearValue);
-
- mDeviceContext->Unmap(mClearVB, 0);
-
- // Apply state
- mDeviceContext->OMSetBlendState(blendState, blendFactors, sampleMask);
- mDeviceContext->OMSetDepthStencilState(dsState, stencilClear);
- mDeviceContext->RSSetState(mScissorEnabled ? mClearScissorRS : mClearNoScissorRS);
-
- // Apply shaders
- ID3D11PixelShader *pixelShader = frameBuffer->usingExtendedDrawBuffers() ? mClearMultiplePS : mClearSinglePS;
-
- mDeviceContext->IASetInputLayout(mClearIL);
- mDeviceContext->VSSetShader(mClearVS, NULL, 0);
- mDeviceContext->PSSetShader(pixelShader, NULL, 0);
- mDeviceContext->GSSetShader(NULL, NULL, 0);
-
- // Apply vertex buffer
- static UINT stride = sizeof(d3d11::PositionDepthColorVertex);
- static UINT startIdx = 0;
- mDeviceContext->IASetVertexBuffers(0, 1, &mClearVB, &stride, &startIdx);
- mDeviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
-
- // Draw the clear quad
- mDeviceContext->Draw(4, 0);
-
- // Clean up
- markAllStateDirty();
-}
-
</del><span class="cx"> void Renderer11::markAllStateDirty()
</span><span class="cx"> {
</span><span class="cx"> for (unsigned int rtIndex = 0; rtIndex < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; rtIndex++)
</span><span class="lines">@@ -1852,12 +1744,12 @@
</span><span class="cx"> for (int i = 0; i < gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; i++)
</span><span class="cx"> {
</span><span class="cx"> mForceSetVertexSamplerStates[i] = true;
</span><del>- mCurVertexTextureSerials[i] = 0;
</del><ins>+ mCurVertexSRVs[i] = NULL;
</ins><span class="cx"> }
</span><span class="cx"> for (int i = 0; i < gl::MAX_TEXTURE_IMAGE_UNITS; i++)
</span><span class="cx"> {
</span><span class="cx"> mForceSetPixelSamplerStates[i] = true;
</span><del>- mCurPixelTextureSerials[i] = 0;
</del><ins>+ mCurPixelSRVs[i] = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mForceSetBlendState = true;
</span><span class="lines">@@ -1866,16 +1758,32 @@
</span><span class="cx"> mForceSetScissor = true;
</span><span class="cx"> mForceSetViewport = true;
</span><span class="cx">
</span><del>- mAppliedIBSerial = 0;
- mAppliedStorageIBSerial = 0;
</del><ins>+ mAppliedIB = NULL;
+ mAppliedIBFormat = DXGI_FORMAT_UNKNOWN;
</ins><span class="cx"> mAppliedIBOffset = 0;
</span><span class="cx">
</span><del>- mAppliedProgramBinarySerial = 0;
</del><ins>+ mAppliedVertexShader = NULL;
+ mAppliedGeometryShader = NULL;
+ mCurPointGeometryShader = NULL;
+ mAppliedPixelShader = NULL;
+
+ for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+ {
+ mAppliedTFBuffers[i] = NULL;
+ mAppliedTFOffsets[i] = 0;
+ }
+
</ins><span class="cx"> memset(&mAppliedVertexConstants, 0, sizeof(dx_VertexConstants));
</span><span class="cx"> memset(&mAppliedPixelConstants, 0, sizeof(dx_PixelConstants));
</span><span class="cx">
</span><span class="cx"> mInputLayoutCache.markDirty();
</span><span class="cx">
</span><ins>+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; i++)
+ {
+ mCurrentConstantBufferVS[i] = -1;
+ mCurrentConstantBufferPS[i] = -1;
+ }
+
</ins><span class="cx"> mCurrentVertexConstantBuffer = NULL;
</span><span class="cx"> mCurrentPixelConstantBuffer = NULL;
</span><span class="cx"> mCurrentGeometryConstantBuffer = NULL;
</span><span class="lines">@@ -1888,40 +1796,14 @@
</span><span class="cx"> mStateCache.clear();
</span><span class="cx"> mInputLayoutCache.clear();
</span><span class="cx">
</span><del>- delete mVertexDataManager;
- mVertexDataManager = NULL;
</del><ins>+ SafeDelete(mVertexDataManager);
+ SafeDelete(mIndexDataManager);
+ SafeDelete(mLineLoopIB);
+ SafeDelete(mTriangleFanIB);
+ SafeDelete(mBlit);
+ SafeDelete(mClear);
+ SafeDelete(mPixelTransfer);
</ins><span class="cx">
</span><del>- delete mIndexDataManager;
- mIndexDataManager = NULL;
-
- delete mLineLoopIB;
- mLineLoopIB = NULL;
-
- delete mTriangleFanIB;
- mTriangleFanIB = NULL;
-
- SafeRelease(mCopyVB);
- SafeRelease(mCopySampler);
- SafeRelease(mCopyIL);
- SafeRelease(mCopyIL);
- SafeRelease(mCopyVS);
- SafeRelease(mCopyRGBAPS);
- SafeRelease(mCopyRGBPS);
- SafeRelease(mCopyLumPS);
- SafeRelease(mCopyLumAlphaPS);
-
- mCopyResourcesInitialized = false;
-
- SafeRelease(mClearVB);
- SafeRelease(mClearIL);
- SafeRelease(mClearVS);
- SafeRelease(mClearSinglePS);
- SafeRelease(mClearMultiplePS);
- SafeRelease(mClearScissorRS);
- SafeRelease(mClearNoScissorRS);
-
- mClearResourcesInitialized = false;
-
</del><span class="cx"> SafeRelease(mDriverConstantBufferVS);
</span><span class="cx"> SafeRelease(mDriverConstantBufferPS);
</span><span class="cx"> SafeRelease(mSyncQuery);
</span><span class="lines">@@ -2011,8 +1893,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- dummyContext->Release();
- dummyDevice->Release();
</del><ins>+ SafeRelease(dummyContext);
+ SafeRelease(dummyDevice);
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -2021,31 +1903,17 @@
</span><span class="cx"> {
</span><span class="cx"> releaseDeviceResources();
</span><span class="cx">
</span><del>- if (mDxgiFactory)
- {
- mDxgiFactory->Release();
- mDxgiFactory = NULL;
- }
</del><ins>+ SafeRelease(mDxgiFactory);
+ SafeRelease(mDxgiAdapter);
</ins><span class="cx">
</span><del>- if (mDxgiAdapter)
- {
- mDxgiAdapter->Release();
- mDxgiAdapter = NULL;
- }
-
</del><span class="cx"> if (mDeviceContext)
</span><span class="cx"> {
</span><span class="cx"> mDeviceContext->ClearState();
</span><span class="cx"> mDeviceContext->Flush();
</span><del>- mDeviceContext->Release();
- mDeviceContext = NULL;
</del><ins>+ SafeRelease(mDeviceContext);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (mDevice)
- {
- mDevice->Release();
- mDevice = NULL;
- }
</del><ins>+ SafeRelease(mDevice);
</ins><span class="cx">
</span><span class="cx"> if (mD3d11Module)
</span><span class="cx"> {
</span><span class="lines">@@ -2058,6 +1926,8 @@
</span><span class="cx"> FreeLibrary(mDxgiModule);
</span><span class="cx"> mDxgiModule = NULL;
</span><span class="cx"> }
</span><ins>+
+ mCompiler.release();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Renderer11::resetDevice()
</span><span class="lines">@@ -2110,17 +1980,17 @@
</span><span class="cx"> return mBGRATextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getDXT1TextureSupport()
</del><ins>+bool Renderer11::getDXT1TextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mDXT1TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getDXT3TextureSupport()
</del><ins>+bool Renderer11::getDXT3TextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mDXT3TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getDXT5TextureSupport()
</del><ins>+bool Renderer11::getDXT5TextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mDXT5TextureSupport;
</span><span class="cx"> }
</span><span class="lines">@@ -2130,35 +2000,66 @@
</span><span class="cx"> return mDepthTextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getFloat32TextureSupport(bool *filtering, bool *renderable)
</del><ins>+bool Renderer11::getFloat32TextureSupport() const
</ins><span class="cx"> {
</span><del>- *renderable = mFloat32RenderSupport;
- *filtering = mFloat32FilterSupport;
</del><span class="cx"> return mFloat32TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getFloat16TextureSupport(bool *filtering, bool *renderable)
</del><ins>+bool Renderer11::getFloat32TextureFilteringSupport() const
</ins><span class="cx"> {
</span><del>- *renderable = mFloat16RenderSupport;
- *filtering = mFloat16FilterSupport;
</del><ins>+ return mFloat32FilterSupport;
+}
+
+bool Renderer11::getFloat32TextureRenderingSupport() const
+{
+ return mFloat32RenderSupport;
+}
+
+bool Renderer11::getFloat16TextureSupport() const
+{
</ins><span class="cx"> return mFloat16TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getLuminanceTextureSupport()
</del><ins>+bool Renderer11::getFloat16TextureFilteringSupport() const
</ins><span class="cx"> {
</span><ins>+ return mFloat16FilterSupport;
+}
+
+bool Renderer11::getFloat16TextureRenderingSupport() const
+{
+ return mFloat16RenderSupport;
+}
+
+bool Renderer11::getRGB565TextureSupport() const
+{
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getLuminanceAlphaTextureSupport()
</del><ins>+bool Renderer11::getLuminanceTextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer11::getLuminanceAlphaTextureSupport() const
+{
+ return false;
+}
+
+bool Renderer11::getRGTextureSupport() const
+{
+ return mRGTextureSupport;
+}
+
</ins><span class="cx"> bool Renderer11::getTextureFilterAnisotropySupport() const
</span><span class="cx"> {
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer11::getPBOSupport() const
+{
+ return true;
+}
+
</ins><span class="cx"> float Renderer11::getTextureMaxAnisotropy() const
</span><span class="cx"> {
</span><span class="cx"> switch (mFeatureLevel)
</span><span class="lines">@@ -2173,7 +2074,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::getEventQuerySupport()
</del><ins>+bool Renderer11::getEventQuerySupport() const
</ins><span class="cx"> {
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -2238,18 +2139,130 @@
</span><span class="cx"> unsigned int Renderer11::getMaxVaryingVectors() const
</span><span class="cx"> {
</span><span class="cx"> META_ASSERT(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT);
</span><ins>+ META_ASSERT(D3D11_VS_OUTPUT_REGISTER_COUNT <= D3D11_PS_INPUT_REGISTER_COUNT);
+ META_ASSERT(D3D10_VS_OUTPUT_REGISTER_COUNT <= D3D10_PS_INPUT_REGISTER_COUNT);
</ins><span class="cx"> switch (mFeatureLevel)
</span><span class="cx"> {
</span><span class="cx"> case D3D_FEATURE_LEVEL_11_0:
</span><del>- return D3D11_VS_OUTPUT_REGISTER_COUNT;
</del><ins>+ return D3D11_VS_OUTPUT_REGISTER_COUNT - getReservedVaryings();
</ins><span class="cx"> case D3D_FEATURE_LEVEL_10_1:
</span><ins>+ return D3D10_1_VS_OUTPUT_REGISTER_COUNT - getReservedVaryings();
</ins><span class="cx"> case D3D_FEATURE_LEVEL_10_0:
</span><del>- return D3D10_VS_OUTPUT_REGISTER_COUNT;
</del><ins>+ return D3D10_VS_OUTPUT_REGISTER_COUNT - getReservedVaryings();
</ins><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned int Renderer11::getMaxVertexShaderUniformBuffers() const
+{
+ META_ASSERT(gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS >= D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT &&
+ gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS >= D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+
+ switch (mFeatureLevel)
+ {
+ 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();
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getMaxFragmentShaderUniformBuffers() const
+{
+ META_ASSERT(gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS >= D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT &&
+ gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS >= D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
+
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - getReservedFragmentUniformBuffers();
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - getReservedFragmentUniformBuffers();
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+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;
+}
+
+unsigned int Renderer11::getReservedVaryings() const
+{
+ // We potentially reserve varyings for gl_Position, _dx_Position, gl_FragCoord and gl_PointSize
+ return 4;
+}
+
+
+unsigned int Renderer11::getMaxTransformFeedbackBuffers() const
+{
+ META_ASSERT(gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS >= D3D11_SO_BUFFER_SLOT_COUNT &&
+ gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS >= D3D10_SO_BUFFER_SLOT_COUNT);
+
+ switch (mFeatureLevel)
+ {
+ 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;
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getMaxTransformFeedbackSeparateComponents() const
+{
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ return getMaxTransformFeedbackInterleavedComponents() / getMaxTransformFeedbackBuffers();
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ // D3D 10 and 10.1 only allow one output per output slot if an output slot other than zero
+ // is used.
+ return 4;
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int Renderer11::getMaxTransformFeedbackInterleavedComponents() const
+{
+ return (getMaxVaryingVectors() * 4);
+}
+
+unsigned int Renderer11::getMaxUniformBufferSize() const
+{
+ // Each component is a 4-element vector of 4-byte units (floats)
+ const unsigned int bytesPerComponent = 4 * sizeof(float);
+
+ switch (mFeatureLevel)
+ {
+ 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;
+ default: UNREACHABLE();
+ return 0;
+ }
+}
+
</ins><span class="cx"> bool Renderer11::getNonPower2TextureSupport() const
</span><span class="cx"> {
</span><span class="cx"> switch (mFeatureLevel)
</span><span class="lines">@@ -2316,6 +2329,24 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int Renderer11::getMaxRecommendedElementsIndices() const
+{
+ META_ASSERT(D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32);
+ META_ASSERT(D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32);
+
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience.
+ return std::numeric_limits<GLint>::max();
+}
+
+int Renderer11::getMaxRecommendedElementsVertices() const
+{
+ META_ASSERT(D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32);
+ META_ASSERT(D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32);
+
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience.
+ return std::numeric_limits<GLint>::max();
+}
+
</ins><span class="cx"> int Renderer11::getMajorShaderModel() const
</span><span class="cx"> {
</span><span class="cx"> switch (mFeatureLevel)
</span><span class="lines">@@ -2386,6 +2417,28 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int Renderer11::getMaxTextureDepth() const
+{
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; // 2048
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION; // 2048
+ default: UNREACHABLE(); return 0;
+ }
+}
+
+int Renderer11::getMaxTextureArrayLayers() const
+{
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION; // 2048
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION; // 512
+ default: UNREACHABLE(); return 0;
+ }
+}
+
</ins><span class="cx"> bool Renderer11::get32BitIndexSupport() const
</span><span class="cx"> {
</span><span class="cx"> switch (mFeatureLevel)
</span><span class="lines">@@ -2412,6 +2465,66 @@
</span><span class="cx"> return mMaxSupportedSamples;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLsizei Renderer11::getMaxSupportedFormatSamples(GLenum internalFormat) const
+{
+ DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
+ MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
+ return (iter != mMultisampleSupportMap.end()) ? iter->second.maxSupportedSamples : 0;
+}
+
+GLsizei Renderer11::getNumSampleCounts(GLenum internalFormat) const
+{
+ unsigned int numCounts = 0;
+
+ // D3D11 supports multisampling for signed and unsigned format, but ES 3.0 does not
+ GLenum componentType = gl::GetComponentType(internalFormat, getCurrentClientVersion());
+ if (componentType != GL_INT && componentType != GL_UNSIGNED_INT)
+ {
+ DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
+ MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
+
+ if (iter != mMultisampleSupportMap.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ for (int i = 0; i < D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; i++)
+ {
+ if (info.qualityLevels[i] > 0)
+ {
+ numCounts++;
+ }
+ }
+ }
+ }
+
+ return numCounts;
+}
+
+void Renderer11::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
+{
+ // D3D11 supports multisampling for signed and unsigned format, but ES 3.0 does not
+ GLenum componentType = gl::GetComponentType(internalFormat, getCurrentClientVersion());
+ if (componentType == GL_INT || componentType == GL_UNSIGNED_INT)
+ {
+ return;
+ }
+
+ DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
+ MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
+
+ if (iter != mMultisampleSupportMap.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ int bufPos = 0;
+ for (int i = D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT - 1; i >= 0 && bufPos < bufSize; i--)
+ {
+ if (info.qualityLevels[i] > 0)
+ {
+ params[bufPos++] = i + 1;
+ }
+ }
+ }
+}
+
</ins><span class="cx"> int Renderer11::getNearestSupportedSamples(DXGI_FORMAT format, unsigned int requested) const
</span><span class="cx"> {
</span><span class="cx"> if (requested == 0)
</span><span class="lines">@@ -2463,7 +2576,10 @@
</span><span class="cx"> TextureStorage11_2D *source11 = TextureStorage11_2D::makeTextureStorage11_2D(source->getStorageInstance());
</span><span class="cx"> TextureStorage11_2D *dest11 = TextureStorage11_2D::makeTextureStorage11_2D(dest->getStorageInstance());
</span><span class="cx">
</span><del>- mDeviceContext->CopyResource(dest11->getBaseTexture(), source11->getBaseTexture());
</del><ins>+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2477,13 +2593,50 @@
</span><span class="cx"> TextureStorage11_Cube *source11 = TextureStorage11_Cube::makeTextureStorage11_Cube(source->getStorageInstance());
</span><span class="cx"> TextureStorage11_Cube *dest11 = TextureStorage11_Cube::makeTextureStorage11_Cube(dest->getStorageInstance());
</span><span class="cx">
</span><del>- mDeviceContext->CopyResource(dest11->getBaseTexture(), source11->getBaseTexture());
</del><ins>+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer11::copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source)
+{
+ if (source && dest)
+ {
+ TextureStorage11_3D *source11 = TextureStorage11_3D::makeTextureStorage11_3D(source->getStorageInstance());
+ TextureStorage11_3D *dest11 = TextureStorage11_3D::makeTextureStorage11_3D(dest->getStorageInstance());
+
+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
+ return true;
+ }
+
+ return false;
+}
+
+bool Renderer11::copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source)
+{
+ if (source && dest)
+ {
+ TextureStorage11_2DArray *source11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(source->getStorageInstance());
+ TextureStorage11_2DArray *dest11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(dest->getStorageInstance());
+
+ mDeviceContext->CopyResource(dest11->getResource(), source11->getResource());
+
+ dest11->invalidateSwizzleCache();
+
+ return true;
+ }
+
+ return false;
+}
+
</ins><span class="cx"> bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
</span><span class="cx"> GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
</span><span class="cx"> {
</span><span class="lines">@@ -2529,15 +2682,19 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Rectangle destRect;
- destRect.x = xoffset;
- destRect.y = yoffset;
- destRect.width = sourceRect.width;
- destRect.height = sourceRect.height;
</del><ins>+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><del>- bool ret = copyTexture(source, sourceRect, sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(),
- dest, destRect, destRenderTarget->getWidth(), destRenderTarget->getHeight(), destFormat);
</del><ins>+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><ins>+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
+
+ storage11->invalidateSwizzleCacheLevel(level);
+
</ins><span class="cx"> return ret;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2572,7 +2729,7 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTarget(target, level));
</del><ins>+ RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTargetFace(target, level));
</ins><span class="cx"> if (!destRenderTarget)
</span><span class="cx"> {
</span><span class="cx"> ERR("Failed to retrieve the render target from the destination storage.");
</span><span class="lines">@@ -2586,194 +2743,144 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- gl::Rectangle destRect;
- destRect.x = xoffset;
- destRect.y = yoffset;
- destRect.width = sourceRect.width;
- destRect.height = sourceRect.height;
</del><ins>+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><del>- bool ret = copyTexture(source, sourceRect, sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(),
- dest, destRect, destRenderTarget->getWidth(), destRenderTarget->getHeight(), destFormat);
</del><ins>+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><ins>+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
+
+ storage11->invalidateSwizzleCacheLevel(level);
+
</ins><span class="cx"> return ret;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::copyTexture(ID3D11ShaderResourceView *source, const gl::Rectangle &sourceArea, unsigned int sourceWidth, unsigned int sourceHeight,
- ID3D11RenderTargetView *dest, const gl::Rectangle &destArea, unsigned int destWidth, unsigned int destHeight, GLenum destFormat)
</del><ins>+bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level)
</ins><span class="cx"> {
</span><del>- HRESULT result;
</del><ins>+ gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer();
+ if (!colorbuffer)
+ {
+ ERR("Failed to retrieve the color buffer from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- if (!mCopyResourcesInitialized)
</del><ins>+ RenderTarget11 *sourceRenderTarget = RenderTarget11::makeRenderTarget11(colorbuffer->getRenderTarget());
+ if (!sourceRenderTarget)
</ins><span class="cx"> {
</span><del>- ASSERT(!mCopyVB && !mCopySampler && !mCopyIL && !mCopyVS && !mCopyRGBAPS && !mCopyRGBPS && !mCopyLumPS && !mCopyLumAlphaPS);
</del><ins>+ ERR("Failed to retrieve the render target from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- 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;
</del><ins>+ ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
+ if (!source)
+ {
+ ERR("Failed to retrieve the render target view from the render target.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- result = mDevice->CreateBuffer(&vbDesc, NULL, &mCopyVB);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyVB, "Renderer11 copy texture vertex buffer");
</del><ins>+ TextureStorage11_3D *storage11 = TextureStorage11_3D::makeTextureStorage11_3D(storage->getStorageInstance());
+ if (!storage11)
+ {
+ ERR("Failed to retrieve the texture storage from the destination.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- D3D11_SAMPLER_DESC samplerDesc;
- samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
- 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.0f;
- samplerDesc.MaxLOD = 0.0f;
</del><ins>+ RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTargetLayer(level, zOffset));
+ if (!destRenderTarget)
+ {
+ ERR("Failed to retrieve the render target from the destination storage.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- result = mDevice->CreateSamplerState(&samplerDesc, &mCopySampler);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopySampler, "Renderer11 copy sampler");
</del><ins>+ ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
+ if (!dest)
+ {
+ ERR("Failed to retrieve the render target view from the destination render target.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- D3D11_INPUT_ELEMENT_DESC quadLayout[] =
- {
- { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
- };
</del><ins>+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><del>- result = mDevice->CreateInputLayout(quadLayout, 2, g_VS_Passthrough, sizeof(g_VS_Passthrough), &mCopyIL);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyIL, "Renderer11 copy texture input layout");
</del><ins>+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><del>- result = mDevice->CreateVertexShader(g_VS_Passthrough, sizeof(g_VS_Passthrough), NULL, &mCopyVS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyVS, "Renderer11 copy texture vertex shader");
</del><ins>+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
</ins><span class="cx">
</span><del>- result = mDevice->CreatePixelShader(g_PS_PassthroughRGBA, sizeof(g_PS_PassthroughRGBA), NULL, &mCopyRGBAPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyRGBAPS, "Renderer11 copy texture RGBA pixel shader");
</del><ins>+ storage11->invalidateSwizzleCacheLevel(level);
</ins><span class="cx">
</span><del>- result = mDevice->CreatePixelShader(g_PS_PassthroughRGB, sizeof(g_PS_PassthroughRGB), NULL, &mCopyRGBPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyRGBPS, "Renderer11 copy texture RGB pixel shader");
</del><ins>+ return ret;
+}
</ins><span class="cx">
</span><del>- result = mDevice->CreatePixelShader(g_PS_PassthroughLum, sizeof(g_PS_PassthroughLum), NULL, &mCopyLumPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyLumPS, "Renderer11 copy texture luminance pixel shader");
</del><ins>+bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level)
+{
+ gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer();
+ if (!colorbuffer)
+ {
+ ERR("Failed to retrieve the color buffer from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- result = mDevice->CreatePixelShader(g_PS_PassthroughLumAlpha, sizeof(g_PS_PassthroughLumAlpha), NULL, &mCopyLumAlphaPS);
- ASSERT(SUCCEEDED(result));
- d3d11::SetDebugName(mCopyLumAlphaPS, "Renderer11 copy texture luminance alpha pixel shader");
</del><ins>+ RenderTarget11 *sourceRenderTarget = RenderTarget11::makeRenderTarget11(colorbuffer->getRenderTarget());
+ if (!sourceRenderTarget)
+ {
+ ERR("Failed to retrieve the render target from the frame buffer.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
</ins><span class="cx">
</span><del>- mCopyResourcesInitialized = true;
</del><ins>+ ID3D11ShaderResourceView *source = sourceRenderTarget->getShaderResourceView();
+ if (!source)
+ {
+ ERR("Failed to retrieve the render target view from the render target.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- // Verify the source and destination area sizes
- if (sourceArea.x < 0 || sourceArea.x + sourceArea.width > static_cast<int>(sourceWidth) ||
- sourceArea.y < 0 || sourceArea.y + sourceArea.height > static_cast<int>(sourceHeight) ||
- destArea.x < 0 || destArea.x + destArea.width > static_cast<int>(destWidth) ||
- destArea.y < 0 || destArea.y + destArea.height > static_cast<int>(destHeight))
</del><ins>+ TextureStorage11_2DArray *storage11 = TextureStorage11_2DArray::makeTextureStorage11_2DArray(storage->getStorageInstance());
+ if (!storage11)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_INVALID_VALUE, false);
</del><ins>+ SafeRelease(source);
+ ERR("Failed to retrieve the texture storage from the destination.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- // Set vertices
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- result = mDeviceContext->Map(mCopyVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
</del><ins>+ RenderTarget11 *destRenderTarget = RenderTarget11::makeRenderTarget11(storage11->getRenderTargetLayer(level, zOffset));
+ if (!destRenderTarget)
</ins><span class="cx"> {
</span><del>- ERR("Failed to map vertex buffer for texture copy, HRESULT: 0x%X.", result);
</del><ins>+ SafeRelease(source);
+ ERR("Failed to retrieve the render target from the destination storage.");
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
-
- // Create a quad in homogeneous coordinates
- float x1 = (destArea.x / float(destWidth)) * 2.0f - 1.0f;
- float y1 = ((destHeight - destArea.y - destArea.height) / float(destHeight)) * 2.0f - 1.0f;
- float x2 = ((destArea.x + destArea.width) / float(destWidth)) * 2.0f - 1.0f;
- float y2 = ((destHeight - destArea.y) / float(destHeight)) * 2.0f - 1.0f;
-
- float u1 = sourceArea.x / float(sourceWidth);
- float v1 = sourceArea.y / float(sourceHeight);
- float u2 = (sourceArea.x + sourceArea.width) / float(sourceWidth);
- float v2 = (sourceArea.y + sourceArea.height) / float(sourceHeight);
-
- d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, u1, v2);
- d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, u1, v1);
- d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, u2, v2);
- d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, u2, v1);
-
- mDeviceContext->Unmap(mCopyVB, 0);
-
- static UINT stride = sizeof(d3d11::PositionTexCoordVertex);
- static UINT startIdx = 0;
- mDeviceContext->IASetVertexBuffers(0, 1, &mCopyVB, &stride, &startIdx);
-
- // Apply state
- mDeviceContext->OMSetBlendState(NULL, NULL, 0xFFFFFFF);
- mDeviceContext->OMSetDepthStencilState(NULL, 0xFFFFFFFF);
- mDeviceContext->RSSetState(NULL);
-
- // Apply shaders
- mDeviceContext->IASetInputLayout(mCopyIL);
- mDeviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
- mDeviceContext->VSSetShader(mCopyVS, NULL, 0);
-
- ID3D11PixelShader *ps = NULL;
- switch(destFormat)
</del><ins>+ ID3D11RenderTargetView *dest = destRenderTarget->getRenderTargetView();
+ if (!dest)
</ins><span class="cx"> {
</span><del>- case GL_RGBA: ps = mCopyRGBAPS; break;
- case GL_RGB: ps = mCopyRGBPS; break;
- case GL_ALPHA: ps = mCopyRGBAPS; break;
- case GL_BGRA_EXT: ps = mCopyRGBAPS; break;
- case GL_LUMINANCE: ps = mCopyLumPS; break;
- case GL_LUMINANCE_ALPHA: ps = mCopyLumAlphaPS; break;
- default: UNREACHABLE(); ps = NULL; break;
</del><ins>+ ERR("Failed to retrieve the render target view from the destination render target.");
+ return gl::error(GL_OUT_OF_MEMORY, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- mDeviceContext->PSSetShader(ps, NULL, 0);
- mDeviceContext->GSSetShader(NULL, NULL, 0);
</del><ins>+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><del>- // Unset the currently bound shader resource to avoid conflicts
- static ID3D11ShaderResourceView *const nullSRV = NULL;
- mDeviceContext->PSSetShaderResources(0, 1, &nullSRV);
</del><ins>+ gl::Box destArea(xoffset, yoffset, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><del>- // Apply render target
- setOneTimeRenderTarget(dest);
</del><ins>+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ bool ret = mBlit->copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL,
+ destFormat, GL_NEAREST);
</ins><span class="cx">
</span><del>- // Set the viewport
- D3D11_VIEWPORT viewport;
- viewport.TopLeftX = 0;
- viewport.TopLeftY = 0;
- viewport.Width = destWidth;
- viewport.Height = destHeight;
- viewport.MinDepth = 0.0f;
- viewport.MaxDepth = 1.0f;
- mDeviceContext->RSSetViewports(1, &viewport);
</del><ins>+ storage11->invalidateSwizzleCacheLevel(level);
</ins><span class="cx">
</span><del>- // Apply textures
- mDeviceContext->PSSetShaderResources(0, 1, &source);
- mDeviceContext->PSSetSamplers(0, 1, &mCopySampler);
-
- // Draw the quad
- mDeviceContext->Draw(4, 0);
-
- // Unbind textures and render targets and vertex buffer
- mDeviceContext->PSSetShaderResources(0, 1, &nullSRV);
-
- unapplyRenderTargets();
-
- UINT zero = 0;
- ID3D11Buffer *const nullBuffer = NULL;
- mDeviceContext->IASetVertexBuffers(0, 1, &nullBuffer, &zero, &zero);
-
- markAllStateDirty();
-
- return true;
</del><ins>+ return ret;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Renderer11::unapplyRenderTargets()
</span><span class="lines">@@ -2805,8 +2912,9 @@
</span><span class="cx"> {
</span><span class="cx"> // Note: depth stencil may be NULL for 0 sized surfaces
</span><span class="cx"> renderTarget = new RenderTarget11(this, swapChain11->getDepthStencil(),
</span><del>- swapChain11->getDepthStencilTexture(), NULL,
- swapChain11->getWidth(), swapChain11->getHeight());
</del><ins>+ swapChain11->getDepthStencilTexture(),
+ swapChain11->getDepthStencilShaderResource(),
+ swapChain11->getWidth(), swapChain11->getHeight(), 1);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -2814,56 +2922,87 @@
</span><span class="cx"> renderTarget = new RenderTarget11(this, swapChain11->getRenderTarget(),
</span><span class="cx"> swapChain11->getOffscreenTexture(),
</span><span class="cx"> swapChain11->getRenderTargetShaderResource(),
</span><del>- swapChain11->getWidth(), swapChain11->getHeight());
</del><ins>+ swapChain11->getWidth(), swapChain11->getHeight(), 1);
</ins><span class="cx"> }
</span><span class="cx"> return renderTarget;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget *Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth)
</del><ins>+RenderTarget *Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples)
</ins><span class="cx"> {
</span><del>- RenderTarget11 *renderTarget = new RenderTarget11(this, width, height, format, samples, depth);
</del><ins>+ RenderTarget11 *renderTarget = new RenderTarget11(this, width, height, format, samples);
</ins><span class="cx"> return renderTarget;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length, rx::ShaderType type)
</del><ins>+ShaderExecutable *Renderer11::loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers)
</ins><span class="cx"> {
</span><span class="cx"> ShaderExecutable11 *executable = NULL;
</span><ins>+ HRESULT result;
</ins><span class="cx">
</span><span class="cx"> switch (type)
</span><span class="cx"> {
</span><span class="cx"> case rx::SHADER_VERTEX:
</span><span class="cx"> {
</span><del>- ID3D11VertexShader *vshader = NULL;
- HRESULT result = mDevice->CreateVertexShader(function, length, NULL, &vshader);
</del><ins>+ ID3D11VertexShader *vertexShader = NULL;
+ ID3D11GeometryShader *streamOutShader = NULL;
+
+ result = mDevice->CreateVertexShader(function, length, NULL, &vertexShader);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- if (vshader)
</del><ins>+ if (transformFeedbackVaryings.size() > 0)
</ins><span class="cx"> {
</span><del>- executable = new ShaderExecutable11(function, length, vshader);
</del><ins>+ std::vector<D3D11_SO_DECLARATION_ENTRY> soDeclaration;
+ for (size_t i = 0; i < transformFeedbackVaryings.size(); i++)
+ {
+ const gl::LinkedVarying &varying = transformFeedbackVaryings[i];
+ for (size_t j = 0; j < 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 = gl::VariableRowCount(type);
+ entry.OutputSlot = (separatedOutputBuffers ? i : 0);
+ soDeclaration.push_back(entry);
+ }
+ }
+
+ result = mDevice->CreateGeometryShaderWithStreamOutput(function, length, soDeclaration.data(), soDeclaration.size(),
+ NULL, 0, 0, NULL, &streamOutShader);
+ ASSERT(SUCCEEDED(result));
</ins><span class="cx"> }
</span><ins>+
+ if (vertexShader)
+ {
+ executable = new ShaderExecutable11(function, length, vertexShader, streamOutShader);
+ }
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case rx::SHADER_PIXEL:
</span><span class="cx"> {
</span><del>- ID3D11PixelShader *pshader = NULL;
- HRESULT result = mDevice->CreatePixelShader(function, length, NULL, &pshader);
</del><ins>+ ID3D11PixelShader *pixelShader = NULL;
+
+ result = mDevice->CreatePixelShader(function, length, NULL, &pixelShader);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- if (pshader)
</del><ins>+ if (pixelShader)
</ins><span class="cx"> {
</span><del>- executable = new ShaderExecutable11(function, length, pshader);
</del><ins>+ executable = new ShaderExecutable11(function, length, pixelShader);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case rx::SHADER_GEOMETRY:
</span><span class="cx"> {
</span><del>- ID3D11GeometryShader *gshader = NULL;
- HRESULT result = mDevice->CreateGeometryShader(function, length, NULL, &gshader);
</del><ins>+ ID3D11GeometryShader *geometryShader = NULL;
+
+ result = mDevice->CreateGeometryShader(function, length, NULL, &geometryShader);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- if (gshader)
</del><ins>+ if (geometryShader)
</ins><span class="cx"> {
</span><del>- executable = new ShaderExecutable11(function, length, gshader);
</del><ins>+ executable = new ShaderExecutable11(function, length, geometryShader);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="lines">@@ -2875,36 +3014,65 @@
</span><span class="cx"> return executable;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
</del><ins>+ShaderExecutable *Renderer11::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround)
</ins><span class="cx"> {
</span><del>- const char *profile = NULL;
-
</del><ins>+ const char *profileType = NULL;
</ins><span class="cx"> switch (type)
</span><span class="cx"> {
</span><span class="cx"> case rx::SHADER_VERTEX:
</span><del>- profile = "vs_4_0";
</del><ins>+ profileType = "vs";
</ins><span class="cx"> break;
</span><span class="cx"> case rx::SHADER_PIXEL:
</span><del>- profile = "ps_4_0";
</del><ins>+ profileType = "ps";
</ins><span class="cx"> break;
</span><span class="cx"> case rx::SHADER_GEOMETRY:
</span><del>- profile = "gs_4_0";
</del><ins>+ profileType = "gs";
</ins><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="cx"> UNREACHABLE();
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
</del><ins>+ const char *profileVersion = NULL;
+ switch (mFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_0:
+ profileVersion = "5_0";
+ break;
+ case D3D_FEATURE_LEVEL_10_1:
+ profileVersion = "4_1";
+ break;
+ case D3D_FEATURE_LEVEL_10_0:
+ profileVersion = "4_0";
+ break;
+ default:
+ UNREACHABLE();
+ return NULL;
+ }
+
+ char profile[32];
+ snprintf(profile, ArraySize(profile), "%s_%s", profileType, profileVersion);
+
+ ID3DBlob *binary = (ID3DBlob*)mCompiler.compileToBinary(infoLog, shaderHLSL, profile, D3DCOMPILE_OPTIMIZATION_LEVEL0, false);
</ins><span class="cx"> if (!binary)
</span><ins>+ {
</ins><span class="cx"> return NULL;
</span><ins>+ }
</ins><span class="cx">
</span><del>- ShaderExecutable *executable = loadExecutable((DWORD *)binary->GetBufferPointer(), binary->GetBufferSize(), type);
- binary->Release();
</del><ins>+ ShaderExecutable *executable = loadExecutable((DWORD *)binary->GetBufferPointer(), binary->GetBufferSize(), type,
+ transformFeedbackVaryings, separatedOutputBuffers);
+ SafeRelease(binary);
</ins><span class="cx">
</span><span class="cx"> return executable;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+rx::UniformStorage *Renderer11::createUniformStorage(size_t storageSize)
+{
+ return new UniformStorage11(this, storageSize);
+}
+
</ins><span class="cx"> VertexBuffer *Renderer11::createVertexBuffer()
</span><span class="cx"> {
</span><span class="cx"> return new VertexBuffer11(this);
</span><span class="lines">@@ -2930,6 +3098,50 @@
</span><span class="cx"> return new Fence11(this);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
+{
+ int clientVersion = getCurrentClientVersion();
+
+ // We only support buffer to texture copies in ES3
+ if (clientVersion <= 2)
+ {
+ return false;
+ }
+
+ // sRGB formats do not work with D3D11 buffer SRVs
+ if (gl::GetColorEncoding(internalFormat, clientVersion) == GL_SRGB)
+ {
+ return false;
+ }
+
+ // We cannot support direct copies to non-color-renderable formats
+ if (!gl::IsColorRenderingSupported(internalFormat, this))
+ {
+ return false;
+ }
+
+ // We skip all 3-channel formats since sometimes format support is missing
+ if (gl::GetComponentCount(internalFormat, clientVersion) == 3)
+ {
+ return false;
+ }
+
+ // We don't support formats which we can't represent without conversion
+ if (getNativeTextureFormat(internalFormat) != internalFormat)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
+{
+ ASSERT(supportsFastCopyBufferToTexture(destinationFormat));
+ return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea);
+}
+
</ins><span class="cx"> bool Renderer11::getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(colorbuffer != NULL);
</span><span class="lines">@@ -2947,8 +3159,8 @@
</span><span class="cx">
</span><span class="cx"> if (textureResource)
</span><span class="cx"> {
</span><del>- HRESULT result = textureResource->QueryInterface(IID_ID3D11Texture2D, (void**)resource);
- textureResource->Release();
</del><ins>+ HRESULT result = textureResource->QueryInterface(__uuidof(ID3D11Texture2D), (void**)resource);
+ SafeRelease(textureResource);
</ins><span class="cx">
</span><span class="cx"> if (SUCCEEDED(result))
</span><span class="cx"> {
</span><span class="lines">@@ -2967,7 +3179,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
</span><del>- bool blitRenderTarget, bool blitDepthStencil)
</del><ins>+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter)
</ins><span class="cx"> {
</span><span class="cx"> if (blitRenderTarget)
</span><span class="cx"> {
</span><span class="lines">@@ -2995,7 +3207,8 @@
</span><span class="cx">
</span><span class="cx"> RenderTarget *drawRenderTarget = drawBuffer->getRenderTarget();
</span><span class="cx">
</span><del>- if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, false))
</del><ins>+ if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, filter, scissor,
+ blitRenderTarget, false, false))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -3003,7 +3216,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (blitDepthStencil)
</del><ins>+ if (blitDepth || blitStencil)
</ins><span class="cx"> {
</span><span class="cx"> gl::Renderbuffer *readBuffer = readTarget->getDepthOrStencilbuffer();
</span><span class="cx"> gl::Renderbuffer *drawBuffer = drawTarget->getDepthOrStencilbuffer();
</span><span class="lines">@@ -3023,17 +3236,20 @@
</span><span class="cx"> RenderTarget *readRenderTarget = readBuffer->getDepthStencil();
</span><span class="cx"> RenderTarget *drawRenderTarget = drawBuffer->getDepthStencil();
</span><span class="cx">
</span><del>- if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, true))
</del><ins>+ if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, filter, scissor,
+ false, blitDepth, blitStencil))
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ invalidateFramebufferSwizzles(drawTarget);
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels)
</del><ins>+void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels)
</ins><span class="cx"> {
</span><span class="cx"> ID3D11Texture2D *colorBufferTexture = NULL;
</span><span class="cx"> unsigned int subresourceIndex = 0;
</span><span class="lines">@@ -3048,11 +3264,9 @@
</span><span class="cx"> area.width = width;
</span><span class="cx"> area.height = height;
</span><span class="cx">
</span><del>- readTextureData(colorBufferTexture, subresourceIndex, area, colorbuffer->getActualFormat(), format, type, outputPitch,
- packReverseRowOrder, packAlignment, pixels);
</del><ins>+ readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch, pack, pixels);
</ins><span class="cx">
</span><del>- colorBufferTexture->Release();
- colorBufferTexture = NULL;
</del><ins>+ SafeRelease(colorBufferTexture);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3065,7 +3279,7 @@
</span><span class="cx"> {
</span><span class="cx"> Image11 *dest11 = Image11::makeImage11(dest);
</span><span class="cx"> Image11 *src11 = Image11::makeImage11(src);
</span><del>- Image11::generateMipmap(dest11, src11);
</del><ins>+ Image11::generateMipmap(getCurrentClientVersion(), dest11, src11);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorage *Renderer11::createTextureStorage2D(SwapChain *swapChain)
</span><span class="lines">@@ -3074,305 +3288,58 @@
</span><span class="cx"> return new TextureStorage11_2D(this, swapChain11);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage *Renderer11::createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
</del><ins>+TextureStorage *Renderer11::createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
</ins><span class="cx"> {
</span><del>- return new TextureStorage11_2D(this, levels, internalformat, usage, forceRenderable, width, height);
</del><ins>+ return new TextureStorage11_2D(this, internalformat, renderTarget, width, height, levels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage *Renderer11::createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
</del><ins>+TextureStorage *Renderer11::createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels)
</ins><span class="cx"> {
</span><del>- return new TextureStorage11_Cube(this, levels, internalformat, usage, forceRenderable, size);
</del><ins>+ return new TextureStorage11_Cube(this, internalformat, renderTarget, size, levels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static inline unsigned int getFastPixelCopySize(DXGI_FORMAT sourceFormat, GLenum sourceGLFormat, GLenum destFormat, GLenum destType)
</del><ins>+TextureStorage *Renderer11::createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
</ins><span class="cx"> {
</span><del>- if (sourceFormat == DXGI_FORMAT_A8_UNORM &&
- destFormat == GL_ALPHA &&
- destType == GL_UNSIGNED_BYTE)
- {
- return 1;
- }
- else if (sourceFormat == DXGI_FORMAT_R8G8B8A8_UNORM &&
- sourceGLFormat == GL_RGBA8_OES &&
- destFormat == GL_RGBA &&
- destType == GL_UNSIGNED_BYTE)
- {
- return 4;
- }
- else if (sourceFormat == DXGI_FORMAT_B8G8R8A8_UNORM &&
- destFormat == GL_BGRA_EXT &&
- destType == GL_UNSIGNED_BYTE)
- {
- return 4;
- }
- else if (sourceFormat == DXGI_FORMAT_R16G16B16A16_FLOAT &&
- sourceGLFormat == GL_RGBA16F_EXT &&
- destFormat == GL_RGBA &&
- destType == GL_HALF_FLOAT_OES)
- {
- return 8;
- }
- else if (sourceFormat == DXGI_FORMAT_R32G32B32_FLOAT &&
- destFormat == GL_RGB &&
- destType == GL_FLOAT)
- {
- return 12;
- }
- else if (sourceFormat == DXGI_FORMAT_R32G32B32A32_FLOAT &&
- sourceGLFormat == GL_RGBA32F_EXT &&
- destFormat == GL_RGBA &&
- destType == GL_FLOAT)
- {
- return 16;
- }
- else
- {
- return 0;
- }
</del><ins>+ return new TextureStorage11_3D(this, internalformat, renderTarget, width, height, depth, levels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static inline void readPixelColor(const unsigned char *data, DXGI_FORMAT format, GLenum glFormat, unsigned int x,
- unsigned int y, int inputPitch, gl::Color *outColor)
</del><ins>+TextureStorage *Renderer11::createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
</ins><span class="cx"> {
</span><del>- switch (format)
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- {
- unsigned int rgba = *reinterpret_cast<const unsigned int*>(data + 4 * x + y * inputPitch);
- outColor->red = (rgba & 0x000000FF) * (1.0f / 0x000000FF);
- outColor->green = (rgba & 0x0000FF00) * (1.0f / 0x0000FF00);
- outColor->blue = (rgba & 0x00FF0000) * (1.0f / 0x00FF0000);
-
- if (gl::GetAlphaSize(glFormat) > 0)
- {
- outColor->alpha = (rgba & 0xFF000000) * (1.0f / 0xFF000000);
- }
- else
- {
- outColor->alpha = 1.0f;
- }
- }
- break;
-
- case DXGI_FORMAT_A8_UNORM:
- {
- outColor->red = 0.0f;
- outColor->green = 0.0f;
- outColor->blue = 0.0f;
- outColor->alpha = *(data + x + y * inputPitch) / 255.0f;
- }
- break;
-
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- {
- outColor->red = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 0);
- outColor->green = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 1);
- outColor->blue = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 2);
-
- if (gl::GetAlphaSize(glFormat) > 0)
- {
- outColor->alpha = *(reinterpret_cast<const float*>(data + 16 * x + y * inputPitch) + 3);
- }
- else
- {
- outColor->alpha = 1.0f;
- }
- }
- break;
-
- case DXGI_FORMAT_R32G32B32_FLOAT:
- {
- outColor->red = *(reinterpret_cast<const float*>(data + 12 * x + y * inputPitch) + 0);
- outColor->green = *(reinterpret_cast<const float*>(data + 12 * x + y * inputPitch) + 1);
- outColor->blue = *(reinterpret_cast<const float*>(data + 12 * x + y * inputPitch) + 2);
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- {
- outColor->red = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 0));
- outColor->green = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 1));
- outColor->blue = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 2));
-
- if (gl::GetAlphaSize(glFormat) > 0)
- {
- outColor->alpha = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 8 * x + y * inputPitch) + 3));
- }
- else
- {
- outColor->alpha = 1.0f;
- }
- }
- break;
-
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- {
- unsigned int bgra = *reinterpret_cast<const unsigned int*>(data + 4 * x + y * inputPitch);
- outColor->red = (bgra & 0x00FF0000) * (1.0f / 0x00FF0000);
- outColor->blue = (bgra & 0x000000FF) * (1.0f / 0x000000FF);
- outColor->green = (bgra & 0x0000FF00) * (1.0f / 0x0000FF00);
- outColor->alpha = (bgra & 0xFF000000) * (1.0f / 0xFF000000);
- }
- break;
-
- case DXGI_FORMAT_R8_UNORM:
- {
- outColor->red = *(data + x + y * inputPitch) / 255.0f;
- outColor->green = 0.0f;
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R8G8_UNORM:
- {
- unsigned short rg = *reinterpret_cast<const unsigned short*>(data + 2 * x + y * inputPitch);
-
- outColor->red = (rg & 0xFF00) * (1.0f / 0xFF00);
- outColor->green = (rg & 0x00FF) * (1.0f / 0x00FF);
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R16_FLOAT:
- {
- outColor->red = gl::float16ToFloat32(*reinterpret_cast<const unsigned short*>(data + 2 * x + y * inputPitch));
- outColor->green = 0.0f;
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- case DXGI_FORMAT_R16G16_FLOAT:
- {
- outColor->red = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 4 * x + y * inputPitch) + 0));
- outColor->green = gl::float16ToFloat32(*(reinterpret_cast<const unsigned short*>(data + 4 * x + y * inputPitch) + 1));
- outColor->blue = 0.0f;
- outColor->alpha = 1.0f;
- }
- break;
-
- default:
- ERR("ReadPixelColor not implemented for DXGI format %u.", format);
- UNIMPLEMENTED();
- break;
- }
</del><ins>+ return new TextureStorage11_2DArray(this, internalformat, renderTarget, width, height, depth, levels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static inline void writePixelColor(const gl::Color &color, GLenum format, GLenum type, unsigned int x,
- unsigned int y, int outputPitch, void *outData)
</del><ins>+void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void *pixels)
</ins><span class="cx"> {
</span><del>- unsigned char* byteData = reinterpret_cast<unsigned char*>(outData);
- unsigned short* shortData = reinterpret_cast<unsigned short*>(outData);
</del><ins>+ ASSERT(area.width >= 0);
+ ASSERT(area.height >= 0);
</ins><span class="cx">
</span><del>- switch (format)
- {
- case GL_RGBA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- byteData[4 * x + y * outputPitch + 0] = static_cast<unsigned char>(255 * color.red + 0.5f);
- byteData[4 * x + y * outputPitch + 1] = static_cast<unsigned char>(255 * color.green + 0.5f);
- byteData[4 * x + y * outputPitch + 2] = static_cast<unsigned char>(255 * color.blue + 0.5f);
- byteData[4 * x + y * outputPitch + 3] = static_cast<unsigned char>(255 * color.alpha + 0.5f);
- break;
</del><ins>+ D3D11_TEXTURE2D_DESC textureDesc;
+ texture->GetDesc(&textureDesc);
</ins><span class="cx">
</span><del>- default:
- ERR("WritePixelColor not implemented for format GL_RGBA and type 0x%X.", type);
- UNIMPLEMENTED();
- break;
- }
- break;
</del><ins>+ // 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<int>(textureDesc.Width));
+ safeArea.y = gl::clamp(area.y, 0, static_cast<int>(textureDesc.Height));
+ safeArea.width = gl::clamp(area.width + std::min(area.x, 0), 0,
+ static_cast<int>(textureDesc.Width) - safeArea.x);
+ safeArea.height = gl::clamp(area.height + std::min(area.y, 0), 0,
+ static_cast<int>(textureDesc.Height) - safeArea.y);
</ins><span class="cx">
</span><del>- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- byteData[4 * x + y * outputPitch + 0] = static_cast<unsigned char>(255 * color.blue + 0.5f);
- byteData[4 * x + y * outputPitch + 1] = static_cast<unsigned char>(255 * color.green + 0.5f);
- byteData[4 * x + y * outputPitch + 2] = static_cast<unsigned char>(255 * color.red + 0.5f);
- byteData[4 * x + y * outputPitch + 3] = static_cast<unsigned char>(255 * color.alpha + 0.5f);
- break;
</del><ins>+ ASSERT(safeArea.x >= 0 && safeArea.y >= 0);
+ ASSERT(safeArea.x + safeArea.width <= static_cast<int>(textureDesc.Width));
+ ASSERT(safeArea.y + safeArea.height <= static_cast<int>(textureDesc.Height));
</ins><span class="cx">
</span><del>- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- shortData[x + y * outputPitch / sizeof(unsigned short)] =
- (static_cast<unsigned short>(15 * color.alpha + 0.5f) << 12) |
- (static_cast<unsigned short>(15 * color.red + 0.5f) << 8) |
- (static_cast<unsigned short>(15 * color.green + 0.5f) << 4) |
- (static_cast<unsigned short>(15 * color.blue + 0.5f) << 0);
- break;
-
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- shortData[x + y * outputPitch / sizeof(unsigned short)] =
- (static_cast<unsigned short>( color.alpha + 0.5f) << 15) |
- (static_cast<unsigned short>(31 * color.red + 0.5f) << 10) |
- (static_cast<unsigned short>(31 * color.green + 0.5f) << 5) |
- (static_cast<unsigned short>(31 * color.blue + 0.5f) << 0);
- break;
-
- default:
- ERR("WritePixelColor not implemented for format GL_BGRA_EXT and type 0x%X.", type);
- UNIMPLEMENTED();
- break;
- }
- break;
-
- case GL_RGB:
- switch (type)
- {
- case GL_UNSIGNED_SHORT_5_6_5:
- shortData[x + y * outputPitch / sizeof(unsigned short)] =
- (static_cast<unsigned short>(31 * color.blue + 0.5f) << 0) |
- (static_cast<unsigned short>(63 * color.green + 0.5f) << 5) |
- (static_cast<unsigned short>(31 * color.red + 0.5f) << 11);
- break;
-
- case GL_UNSIGNED_BYTE:
- byteData[3 * x + y * outputPitch + 0] = static_cast<unsigned char>(255 * color.red + 0.5f);
- byteData[3 * x + y * outputPitch + 1] = static_cast<unsigned char>(255 * color.green + 0.5f);
- byteData[3 * x + y * outputPitch + 2] = static_cast<unsigned char>(255 * color.blue + 0.5f);
- break;
-
- default:
- ERR("WritePixelColor not implemented for format GL_RGB and type 0x%X.", type);
- UNIMPLEMENTED();
- break;
- }
- break;
-
- default:
- ERR("WritePixelColor not implemented for format 0x%X.", format);
- UNIMPLEMENTED();
- break;
</del><ins>+ if (safeArea.width == 0 || safeArea.height == 0)
+ {
+ // no work to do
+ return;
</ins><span class="cx"> }
</span><del>-}
</del><span class="cx">
</span><del>-void Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
- GLint packAlignment, void *pixels)
-{
- D3D11_TEXTURE2D_DESC textureDesc;
- texture->GetDesc(&textureDesc);
-
</del><span class="cx"> D3D11_TEXTURE2D_DESC stagingDesc;
</span><del>- stagingDesc.Width = area.width;
- stagingDesc.Height = area.height;
</del><ins>+ stagingDesc.Width = safeArea.width;
+ stagingDesc.Height = safeArea.height;
</ins><span class="cx"> stagingDesc.MipLevels = 1;
</span><span class="cx"> stagingDesc.ArraySize = 1;
</span><span class="cx"> stagingDesc.Format = textureDesc.Format;
</span><span class="lines">@@ -3411,7 +3378,7 @@
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ERR("Failed to create resolve texture for readPixels, HRESULT: 0x%X.", result);
</span><del>- stagingTex->Release();
</del><ins>+ SafeRelease(stagingTex);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3425,26 +3392,37 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> D3D11_BOX srcBox;
</span><del>- srcBox.left = area.x;
- srcBox.right = area.x + area.width;
- srcBox.top = area.y;
- srcBox.bottom = area.y + area.height;
- srcBox.front = 0;
- srcBox.back = 1;
</del><ins>+ srcBox.left = static_cast<UINT>(safeArea.x);
+ srcBox.right = static_cast<UINT>(safeArea.x + safeArea.width);
+ srcBox.top = static_cast<UINT>(safeArea.y);
+ srcBox.bottom = static_cast<UINT>(safeArea.y + safeArea.height);
+ srcBox.front = 0;
+ srcBox.back = 1;
</ins><span class="cx">
</span><span class="cx"> mDeviceContext->CopySubresourceRegion(stagingTex, 0, 0, 0, 0, srcTex, subResource, &srcBox);
</span><span class="cx">
</span><del>- srcTex->Release();
- srcTex = NULL;
</del><ins>+ SafeRelease(srcTex);
</ins><span class="cx">
</span><ins>+ PackPixelsParams packParams(safeArea, format, type, outputPitch, pack, 0);
+ packPixels(stagingTex, packParams, pixels);
+
+ SafeRelease(stagingTex);
+}
+
+void Renderer11::packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &params, void *pixelsOut)
+{
+ D3D11_TEXTURE2D_DESC textureDesc;
+ readTexture->GetDesc(&textureDesc);
+
</ins><span class="cx"> D3D11_MAPPED_SUBRESOURCE mapping;
</span><del>- mDeviceContext->Map(stagingTex, 0, D3D11_MAP_READ, 0, &mapping);
</del><ins>+ HRESULT hr = mDeviceContext->Map(readTexture, 0, D3D11_MAP_READ, 0, &mapping);
+ ASSERT(SUCCEEDED(hr));
</ins><span class="cx">
</span><span class="cx"> unsigned char *source;
</span><span class="cx"> int inputPitch;
</span><del>- if (packReverseRowOrder)
</del><ins>+ if (params.pack.reverseRowOrder)
</ins><span class="cx"> {
</span><del>- source = static_cast<unsigned char*>(mapping.pData) + mapping.RowPitch * (area.height - 1);
</del><ins>+ source = static_cast<unsigned char*>(mapping.pData) + mapping.RowPitch * (params.area.height - 1);
</ins><span class="cx"> inputPitch = -static_cast<int>(mapping.RowPitch);
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -3453,58 +3431,82 @@
</span><span class="cx"> inputPitch = static_cast<int>(mapping.RowPitch);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned int fastPixelSize = getFastPixelCopySize(textureDesc.Format, sourceFormat, format, type);
- if (fastPixelSize != 0)
</del><ins>+ GLuint clientVersion = getCurrentClientVersion();
+
+ GLenum sourceInternalFormat = d3d11_gl::GetInternalFormat(textureDesc.Format, clientVersion);
+ GLenum sourceFormat = gl::GetFormat(sourceInternalFormat, clientVersion);
+ GLenum sourceType = gl::GetType(sourceInternalFormat, clientVersion);
+
+ GLuint sourcePixelSize = gl::GetPixelBytes(sourceInternalFormat, clientVersion);
+
+ if (sourceFormat == params.format && sourceType == params.type)
</ins><span class="cx"> {
</span><del>- unsigned char *dest = static_cast<unsigned char*>(pixels);
- for (int j = 0; j < area.height; j++)
</del><ins>+ unsigned char *dest = static_cast<unsigned char*>(pixelsOut) + params.offset;
+ for (int y = 0; y < params.area.height; y++)
</ins><span class="cx"> {
</span><del>- memcpy(dest + j * outputPitch, source + j * inputPitch, area.width * fastPixelSize);
</del><ins>+ memcpy(dest + y * params.outputPitch, source + y * inputPitch, params.area.width * sourcePixelSize);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (textureDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM &&
- format == GL_RGBA &&
- type == GL_UNSIGNED_BYTE)
</del><ins>+ else
</ins><span class="cx"> {
</span><del>- // Fast path for swapping red with blue
- unsigned char *dest = static_cast<unsigned char*>(pixels);
</del><ins>+ GLenum destInternalFormat = gl::GetSizedInternalFormat(params.format, params.type, clientVersion);
+ GLuint destPixelSize = gl::GetPixelBytes(destInternalFormat, clientVersion);
</ins><span class="cx">
</span><del>- for (int j = 0; j < area.height; j++)
</del><ins>+ ColorCopyFunction fastCopyFunc = d3d11::GetFastCopyFunction(textureDesc.Format, params.format, params.type);
+ if (fastCopyFunc)
</ins><span class="cx"> {
</span><del>- for (int i = 0; i < area.width; i++)
</del><ins>+ // Fast copy is possible through some special function
+ for (int y = 0; y < params.area.height; y++)
</ins><span class="cx"> {
</span><del>- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
- *(unsigned int*)(dest + 4 * i + j * outputPitch) =
- (argb & 0xFF00FF00) | // Keep alpha and green
- (argb & 0x00FF0000) >> 16 | // Move red to blue
- (argb & 0x000000FF) << 16; // Move blue to red
</del><ins>+ for (int x = 0; x < params.area.width; x++)
+ {
+ void *dest = static_cast<unsigned char*>(pixelsOut) + params.offset + y * params.outputPitch + x * destPixelSize;
+ void *src = static_cast<unsigned char*>(source) + y * inputPitch + x * sourcePixelSize;
+
+ fastCopyFunc(src, dest);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- }
- else
- {
- gl::Color pixelColor;
- for (int j = 0; j < area.height; j++)
</del><ins>+ else
</ins><span class="cx"> {
</span><del>- for (int i = 0; i < area.width; i++)
</del><ins>+ ColorReadFunction readFunc = d3d11::GetColorReadFunction(textureDesc.Format);
+ ColorWriteFunction writeFunc = gl::GetColorWriteFunction(params.format, params.type, clientVersion);
+
+ unsigned char temp[16]; // Maximum size of any Color<T> type used.
+ META_ASSERT(sizeof(temp) >= sizeof(gl::ColorF) &&
+ sizeof(temp) >= sizeof(gl::ColorUI) &&
+ sizeof(temp) >= sizeof(gl::ColorI));
+
+ for (int y = 0; y < params.area.height; y++)
</ins><span class="cx"> {
</span><del>- readPixelColor(source, textureDesc.Format, sourceFormat, i, j, inputPitch, &pixelColor);
- writePixelColor(pixelColor, format, type, i, j, outputPitch, pixels);
</del><ins>+ for (int x = 0; x < params.area.width; x++)
+ {
+ void *dest = static_cast<unsigned char*>(pixelsOut) + params.offset + y * params.outputPitch + x * destPixelSize;
+ void *src = static_cast<unsigned char*>(source) + y * inputPitch + x * sourcePixelSize;
+
+ // readFunc and writeFunc will be using the same type of color, CopyTexImage
+ // will not allow the copy otherwise.
+ readFunc(src, temp);
+ writeFunc(temp, dest);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mDeviceContext->Unmap(stagingTex, 0);
-
- stagingTex->Release();
- stagingTex = NULL;
</del><ins>+ mDeviceContext->Unmap(readTexture, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
- RenderTarget *drawRenderTarget, bool wholeBufferCopy)
</del><ins>+bool Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
+ RenderTarget *drawRenderTarget, GLenum filter, const gl::Rectangle *scissor,
+ bool colorBlit, bool depthBlit, bool stencilBlit)
</ins><span class="cx"> {
</span><del>- ASSERT(readRect.width == drawRect.width && readRect.height == drawRect.height);
</del><ins>+ // 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));
</ins><span class="cx">
</span><ins>+ bool result = true;
+
</ins><span class="cx"> RenderTarget11 *drawRenderTarget11 = RenderTarget11::makeRenderTarget11(drawRenderTarget);
</span><span class="cx"> if (!drawRenderTarget)
</span><span class="cx"> {
</span><span class="lines">@@ -3512,8 +3514,10 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ID3D11Texture2D *drawTexture = drawRenderTarget11->getTexture();
</del><ins>+ ID3D11Resource *drawTexture = drawRenderTarget11->getTexture();
</ins><span class="cx"> unsigned int drawSubresource = drawRenderTarget11->getSubresourceIndex();
</span><ins>+ ID3D11RenderTargetView *drawRTV = drawRenderTarget11->getRenderTargetView();
+ ID3D11DepthStencilView *drawDSV = drawRenderTarget11->getDepthStencilView();
</ins><span class="cx">
</span><span class="cx"> RenderTarget11 *readRenderTarget11 = RenderTarget11::makeRenderTarget11(readRenderTarget);
</span><span class="cx"> if (!readRenderTarget)
</span><span class="lines">@@ -3522,44 +3526,152 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ID3D11Texture2D *readTexture = NULL;
</del><ins>+ ID3D11Resource *readTexture = NULL;
+ ID3D11ShaderResourceView *readSRV = NULL;
</ins><span class="cx"> unsigned int readSubresource = 0;
</span><span class="cx"> if (readRenderTarget->getSamples() > 0)
</span><span class="cx"> {
</span><del>- readTexture = resolveMultisampledTexture(readRenderTarget11->getTexture(), readRenderTarget11->getSubresourceIndex());
- readSubresource = 0;
</del><ins>+ ID3D11Resource *unresolvedResource = readRenderTarget11->getTexture();
+ ID3D11Texture2D *unresolvedTexture = d3d11::DynamicCastComObject<ID3D11Texture2D>(unresolvedResource);
+
+ if (unresolvedTexture)
+ {
+ readTexture = resolveMultisampledTexture(unresolvedTexture, readRenderTarget11->getSubresourceIndex());
+ readSubresource = 0;
+
+ SafeRelease(unresolvedTexture);
+
+ HRESULT hresult = mDevice->CreateShaderResourceView(readTexture, NULL, &readSRV);
+ if (FAILED(hresult))
+ {
+ SafeRelease(readTexture);
+ return gl::error(GL_OUT_OF_MEMORY, false);
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> readTexture = readRenderTarget11->getTexture();
</span><span class="cx"> readTexture->AddRef();
</span><span class="cx"> readSubresource = readRenderTarget11->getSubresourceIndex();
</span><ins>+ readSRV = readRenderTarget11->getShaderResourceView();
+ readSRV->AddRef();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (!readTexture)
</del><ins>+ if (!readTexture || !readSRV)
</ins><span class="cx"> {
</span><ins>+ SafeRelease(readTexture);
+ SafeRelease(readSRV);
</ins><span class="cx"> ERR("Failed to retrieve the read render target view from the read render target.");
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- 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;
</del><ins>+ gl::Extents readSize(readRenderTarget->getWidth(), readRenderTarget->getHeight(), 1);
+ gl::Extents drawSize(drawRenderTarget->getWidth(), drawRenderTarget->getHeight(), 1);
</ins><span class="cx">
</span><del>- // 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 : &readBox;
</del><ins>+ bool scissorNeeded = scissor && gl::ClipRectangle(drawRect, *scissor, NULL);
</ins><span class="cx">
</span><del>- mDeviceContext->CopySubresourceRegion(drawTexture, drawSubresource, drawRect.x, drawRect.y, 0,
- readTexture, readSubresource, pSrcBox);
</del><ins>+ bool wholeBufferCopy = !scissorNeeded &&
+ readRect.x == 0 && readRect.width == readSize.width &&
+ readRect.y == 0 && readRect.height == readSize.height &&
+ drawRect.x == 0 && drawRect.width == drawSize.width &&
+ drawRect.y == 0 && drawRect.height == drawSize.height;
</ins><span class="cx">
</span><ins>+ bool stretchRequired = readRect.width != drawRect.width || readRect.height != drawRect.height;
+
+ bool flipRequired = readRect.width < 0 || readRect.height < 0 || drawRect.width < 0 || drawRect.height < 0;
+
+ bool outOfBounds = readRect.x < 0 || readRect.x + readRect.width > readSize.width ||
+ readRect.y < 0 || readRect.y + readRect.height > readSize.height ||
+ drawRect.x < 0 || drawRect.x + drawRect.width > drawSize.width ||
+ drawRect.y < 0 || drawRect.y + drawRect.height > drawSize.height;
+
+ bool hasDepth = gl::GetDepthBits(drawRenderTarget11->getActualFormat(), getCurrentClientVersion()) > 0;
+ bool hasStencil = gl::GetStencilBits(drawRenderTarget11->getActualFormat(), getCurrentClientVersion()) > 0;
+ bool partialDSBlit = (hasDepth && depthBlit) != (hasStencil && stencilBlit);
+
+ if (readRenderTarget11->getActualFormat() == drawRenderTarget->getActualFormat() &&
+ !stretchRequired && !outOfBounds && !flipRequired && !partialDSBlit &&
+ (!(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 >= 0 || drawRect.height >= 0);
+
+ if (drawRect.x < scissor->x)
+ {
+ dstX = scissor->x;
+ readBox.left += (scissor->x - drawRect.x);
+ }
+ if (drawRect.y < scissor->y)
+ {
+ dstY = scissor->y;
+ readBox.top += (scissor->y - drawRect.y);
+ }
+ if (drawRect.x + drawRect.width > scissor->x + scissor->width)
+ {
+ readBox.right -= ((drawRect.x + drawRect.width) - (scissor->x + scissor->width));
+ }
+ if (drawRect.y + drawRect.height > scissor->y + scissor->height)
+ {
+ readBox.bottom -= ((drawRect.y + drawRect.height) - (scissor->y + scissor->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 : &readBox;
+
+ mDeviceContext->CopySubresourceRegion(drawTexture, drawSubresource, dstX, dstY, 0,
+ readTexture, readSubresource, pSrcBox);
+ result = true;
+ }
+ 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 && stencilBlit)
+ {
+ result = mBlit->copyDepthStencil(readTexture, readSubresource, readArea, readSize,
+ drawTexture, drawSubresource, drawArea, drawSize,
+ scissor);
+ }
+ else if (depthBlit)
+ {
+ result = mBlit->copyDepth(readSRV, readArea, readSize, drawDSV, drawArea, drawSize,
+ scissor);
+ }
+ else if (stencilBlit)
+ {
+ result = mBlit->copyStencil(readTexture, readSubresource, readArea, readSize,
+ drawTexture, drawSubresource, drawArea, drawSize,
+ scissor);
+ }
+ else
+ {
+ GLenum format = gl::GetFormat(drawRenderTarget->getInternalFormat(), getCurrentClientVersion());
+ result = mBlit->copyTexture(readSRV, readArea, readSize, drawRTV, drawArea, drawSize,
+ scissor, format, filter);
+ }
+ }
+
</ins><span class="cx"> SafeRelease(readTexture);
</span><ins>+ SafeRelease(readSRV);
</ins><span class="cx">
</span><del>- return true;
</del><ins>+ return result;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource)
</span><span class="lines">@@ -3600,6 +3712,46 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Renderer11::invalidateRenderbufferSwizzles(gl::Renderbuffer *renderBuffer, int mipLevel)
+{
+ TextureStorage *texStorage = renderBuffer->getTextureStorage();
+ if (texStorage)
+ {
+ TextureStorage11 *texStorage11 = TextureStorage11::makeTextureStorage11(texStorage);
+ if (!texStorage11)
+ {
+ ERR("texture storage pointer unexpectedly null.");
+ return;
+ }
+
+ texStorage11->invalidateSwizzleCacheLevel(mipLevel);
+ }
+}
+
+void Renderer11::invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer)
+{
+ for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
+ {
+ gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(colorAttachment);
+ if (colorbuffer)
+ {
+ invalidateRenderbufferSwizzles(colorbuffer, framebuffer->getColorbufferMipLevel(colorAttachment));
+ }
+ }
+
+ gl::Renderbuffer *depthBuffer = framebuffer->getDepthbuffer();
+ if (depthBuffer)
+ {
+ invalidateRenderbufferSwizzles(depthBuffer, framebuffer->getDepthbufferMipLevel());
+ }
+
+ gl::Renderbuffer *stencilBuffer = framebuffer->getStencilbuffer();
+ if (stencilBuffer)
+ {
+ invalidateRenderbufferSwizzles(stencilBuffer, framebuffer->getStencilbufferMipLevel());
+ }
+}
+
</ins><span class="cx"> bool Renderer11::getLUID(LUID *adapterLuid) const
</span><span class="cx"> {
</span><span class="cx"> adapterLuid->HighPart = 0;
</span><span class="lines">@@ -3620,4 +3772,47 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLenum Renderer11::getNativeTextureFormat(GLenum internalFormat) const
+{
+ int clientVersion = getCurrentClientVersion();
+ return d3d11_gl::GetInternalFormat(gl_d3d11::GetTexFormat(internalFormat, clientVersion), clientVersion);
</ins><span class="cx"> }
</span><ins>+
+rx::VertexConversionType Renderer11::getVertexConversionType(const gl::VertexFormat &vertexFormat) const
+{
+ return gl_d3d11::GetVertexConversionType(vertexFormat);
+}
+
+GLenum Renderer11::getVertexComponentType(const gl::VertexFormat &vertexFormat) const
+{
+ return d3d11::GetComponentType(gl_d3d11::GetNativeVertexFormat(vertexFormat));
+}
+
+Renderer11::MultisampleSupportInfo Renderer11::getMultisampleSupportInfo(DXGI_FORMAT format)
+{
+ MultisampleSupportInfo supportInfo = { 0 };
+
+ UINT formatSupport;
+ HRESULT result;
+
+ result = mDevice->CheckFormatSupport(format, &formatSupport);
+ if (SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET))
+ {
+ for (unsigned int i = 1; i <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; i++)
+ {
+ result = mDevice->CheckMultisampleQualityLevels(format, i, &supportInfo.qualityLevels[i - 1]);
+ if (SUCCEEDED(result) && supportInfo.qualityLevels[i - 1] > 0)
+ {
+ supportInfo.maxSupportedSamples = std::max(supportInfo.maxSupportedSamples, i);
+ }
+ else
+ {
+ supportInfo.qualityLevels[i - 1] = 0;
+ }
+ }
+ }
+
+ return supportInfo;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11Renderer11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/Renderer11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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">@@ -11,9 +11,10 @@
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><span class="cx"> #include "libGLESv2/angletypes.h"
</span><del>-#include "libGLESv2/mathutil.h"
</del><ins>+#include "common/mathutil.h"
</ins><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><ins>+#include "libGLESv2/renderer/d3d/HLSLCompiler.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d11/RenderStateCache.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/InputLayoutCache.h"
</span><span class="cx"> #include "libGLESv2/renderer/RenderTarget.h"
</span><span class="lines">@@ -29,6 +30,10 @@
</span><span class="cx"> class VertexDataManager;
</span><span class="cx"> class IndexDataManager;
</span><span class="cx"> class StreamingIndexBufferInterface;
</span><ins>+class Blit11;
+class Clear11;
+class PixelTransfer11;
+struct PackPixelsParams;
</ins><span class="cx">
</span><span class="cx"> enum
</span><span class="cx"> {
</span><span class="lines">@@ -54,11 +59,14 @@
</span><span class="cx">
</span><span class="cx"> virtual SwapChain *createSwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat);
</span><span class="cx">
</span><ins>+ virtual void generateSwizzle(gl::Texture *texture);
</ins><span class="cx"> virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler);
</span><span class="cx"> virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
</span><span class="cx">
</span><ins>+ virtual bool setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[]);
+
</ins><span class="cx"> virtual void setRasterizerState(const gl::RasterizerState &rasterState);
</span><del>- virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
</del><ins>+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
</ins><span class="cx"> unsigned int sampleMask);
</span><span class="cx"> virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
</span><span class="cx"> int stencilBackRef, bool frontFaceCCW);
</span><span class="lines">@@ -69,13 +77,16 @@
</span><span class="cx">
</span><span class="cx"> virtual bool applyPrimitiveType(GLenum mode, GLsizei count);
</span><span class="cx"> virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
</span><del>- virtual void applyShaders(gl::ProgramBinary *programBinary);
- virtual void applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray);
- virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
</del><ins>+ virtual void applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[]);
+ virtual void applyUniforms(const gl::ProgramBinary &programBinary);
+ virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances);
</ins><span class="cx"> virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
</span><ins>+ virtual void applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[]);
</ins><span class="cx">
</span><del>- virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
- virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
</del><ins>+ virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive);
+ virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
</ins><span class="cx">
</span><span class="cx"> virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
</span><span class="cx">
</span><span class="lines">@@ -93,14 +104,20 @@
</span><span class="cx"> virtual GUID getAdapterIdentifier() const;
</span><span class="cx">
</span><span class="cx"> virtual bool getBGRATextureSupport() const;
</span><del>- virtual bool getDXT1TextureSupport();
- virtual bool getDXT3TextureSupport();
- virtual bool getDXT5TextureSupport();
- virtual bool getEventQuerySupport();
- virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable);
- virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable);
- virtual bool getLuminanceTextureSupport();
- virtual bool getLuminanceAlphaTextureSupport();
</del><ins>+ virtual bool getDXT1TextureSupport() const;
+ virtual bool getDXT3TextureSupport() const;
+ virtual bool getDXT5TextureSupport() const;
+ virtual bool getEventQuerySupport() const;
+ virtual bool getFloat32TextureSupport() const;
+ virtual bool getFloat32TextureFilteringSupport() const;
+ virtual bool getFloat32TextureRenderingSupport() const;
+ virtual bool getFloat16TextureSupport() const;
+ virtual bool getFloat16TextureFilteringSupport() const;
+ virtual bool getFloat16TextureRenderingSupport() const;
+ virtual bool getRGB565TextureSupport() const;
+ virtual bool getLuminanceTextureSupport() const;
+ virtual bool getLuminanceAlphaTextureSupport() const;
+ virtual bool getRGTextureSupport() const;
</ins><span class="cx"> virtual unsigned int getMaxVertexTextureImageUnits() const;
</span><span class="cx"> virtual unsigned int getMaxCombinedTextureImageUnits() const;
</span><span class="cx"> virtual unsigned int getReservedVertexUniformVectors() const;
</span><span class="lines">@@ -108,26 +125,43 @@
</span><span class="cx"> virtual unsigned int getMaxVertexUniformVectors() const;
</span><span class="cx"> virtual unsigned int getMaxFragmentUniformVectors() const;
</span><span class="cx"> virtual unsigned int getMaxVaryingVectors() const;
</span><ins>+ virtual unsigned int getMaxVertexShaderUniformBuffers() const;
+ virtual unsigned int getMaxFragmentShaderUniformBuffers() const;
+ virtual unsigned int getReservedVertexUniformBuffers() const;
+ virtual unsigned int getReservedFragmentUniformBuffers() const;
+ unsigned int getReservedVaryings() const;
+ virtual unsigned int getMaxTransformFeedbackBuffers() const;
+ virtual unsigned int getMaxTransformFeedbackSeparateComponents() const;
+ virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const;
+ virtual unsigned int getMaxUniformBufferSize() const;
</ins><span class="cx"> virtual bool getNonPower2TextureSupport() const;
</span><span class="cx"> virtual bool getDepthTextureSupport() const;
</span><span class="cx"> virtual bool getOcclusionQuerySupport() const;
</span><span class="cx"> virtual bool getInstancingSupport() const;
</span><span class="cx"> virtual bool getTextureFilterAnisotropySupport() const;
</span><ins>+ virtual bool getPBOSupport() const;
</ins><span class="cx"> virtual float getTextureMaxAnisotropy() const;
</span><span class="cx"> virtual bool getShareHandleSupport() const;
</span><span class="cx"> virtual bool getDerivativeInstructionSupport() const;
</span><span class="cx"> virtual bool getPostSubBufferSupport() const;
</span><ins>+ virtual int getMaxRecommendedElementsIndices() const;
+ virtual int getMaxRecommendedElementsVertices() const;
</ins><span class="cx">
</span><span class="cx"> virtual int getMajorShaderModel() const;
</span><span class="cx"> virtual float getMaxPointSize() const;
</span><span class="cx"> virtual int getMaxViewportDimension() const;
</span><span class="cx"> virtual int getMaxTextureWidth() const;
</span><span class="cx"> virtual int getMaxTextureHeight() const;
</span><ins>+ virtual int getMaxTextureDepth() const;
+ virtual int getMaxTextureArrayLayers() const;
</ins><span class="cx"> virtual bool get32BitIndexSupport() const;
</span><span class="cx"> virtual int getMinSwapInterval() const;
</span><span class="cx"> virtual int getMaxSwapInterval() const;
</span><span class="cx">
</span><span class="cx"> virtual GLsizei getMaxSupportedSamples() const;
</span><ins>+ virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+ virtual GLsizei getNumSampleCounts(GLenum internalFormat) const;
+ virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
</ins><span class="cx"> int getNearestSupportedSamples(DXGI_FORMAT format, unsigned int requested) const;
</span><span class="cx">
</span><span class="cx"> virtual unsigned int getMaxRenderTargets() const;
</span><span class="lines">@@ -135,34 +169,44 @@
</span><span class="cx"> // Pixel operations
</span><span class="cx"> virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source);
</span><span class="cx"> virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source);
</span><ins>+ virtual bool copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source);
+ virtual bool copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source);
</ins><span class="cx">
</span><span class="cx"> virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
</span><span class="cx"> GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
</span><span class="cx"> virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
</span><span class="cx"> GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level);
</span><ins>+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level);
</ins><span class="cx">
</span><del>- bool copyTexture(ID3D11ShaderResourceView *source, const gl::Rectangle &sourceArea, unsigned int sourceWidth, unsigned int sourceHeight,
- ID3D11RenderTargetView *dest, const gl::Rectangle &destArea, unsigned int destWidth, unsigned int destHeight, GLenum destFormat);
-
</del><span class="cx"> virtual bool blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
</span><del>- bool blitRenderTarget, bool blitDepthStencil);
- virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels);
</del><ins>+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter);
+ virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels);
</ins><span class="cx">
</span><span class="cx"> // RenderTarget creation
</span><span class="cx"> virtual RenderTarget *createRenderTarget(SwapChain *swapChain, bool depth);
</span><del>- virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth);
</del><ins>+ virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples);
</ins><span class="cx">
</span><span class="cx"> // Shader operations
</span><del>- virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
</del><ins>+ virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround);
+ virtual UniformStorage *createUniformStorage(size_t storageSize);
</ins><span class="cx">
</span><span class="cx"> // Image operations
</span><span class="cx"> virtual Image *createImage();
</span><span class="cx"> virtual void generateMipmap(Image *dest, Image *source);
</span><span class="cx"> virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain);
</span><del>- virtual TextureStorage *createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
- virtual TextureStorage *createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
</del><ins>+ virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
+ virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels);
+ 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);
</ins><span class="cx">
</span><span class="cx"> // Buffer creation
</span><span class="cx"> virtual VertexBuffer *createVertexBuffer();
</span><span class="lines">@@ -178,11 +222,22 @@
</span><span class="cx"> ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
</span><span class="cx"> IDXGIFactory *getDxgiFactory() { return mDxgiFactory; };
</span><span class="cx">
</span><ins>+ Blit11 *getBlitter() { return mBlit; }
+
+ // Buffer-to-texture and Texture-to-buffer copies
+ virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
+ virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
+
</ins><span class="cx"> bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
</span><span class="cx"> void unapplyRenderTargets();
</span><span class="cx"> void setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView);
</span><ins>+ void packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &params, void *pixelsOut);
</ins><span class="cx">
</span><span class="cx"> virtual bool getLUID(LUID *adapterLuid) const;
</span><ins>+ virtual GLenum getNativeTextureFormat(GLenum internalFormat) const;
+ virtual rx::VertexConversionType getVertexConversionType(const gl::VertexFormat &vertexFormat) const;
+ virtual GLenum getVertexComponentType(const gl::VertexFormat &vertexFormat) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Renderer11);
</span><span class="lines">@@ -190,21 +245,25 @@
</span><span class="cx"> void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
</span><span class="cx"> void drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances);
</span><span class="cx">
</span><del>- void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area,
- GLenum sourceFormat, GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder,
- GLint packAlignment, void *pixels);
</del><ins>+ void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void *pixels);
</ins><span class="cx">
</span><del>- void maskedClear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
</del><span class="cx"> rx::Range getViewportBounds() const;
</span><span class="cx">
</span><del>- bool blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
- RenderTarget *drawRenderTarget, bool wholeBufferCopy);
</del><ins>+ bool blitRenderbufferRect(const gl::Rectangle &readRect, const gl::Rectangle &drawRect, RenderTarget *readRenderTarget,
+ RenderTarget *drawRenderTarget, GLenum filter, const gl::Rectangle *scissor,
+ bool colorBlit, bool depthBlit, bool stencilBlit);
</ins><span class="cx"> ID3D11Texture2D *resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource);
</span><span class="cx">
</span><ins>+ static void invalidateRenderbufferSwizzles(gl::Renderbuffer *renderBuffer, int mipLevel);
+ static void invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer);
+
</ins><span class="cx"> HMODULE mD3d11Module;
</span><span class="cx"> HMODULE mDxgiModule;
</span><span class="cx"> HDC mDc;
</span><span class="cx">
</span><ins>+ HLSLCompiler mCompiler;
+
</ins><span class="cx"> bool mDeviceLost;
</span><span class="cx">
</span><span class="cx"> void initializeDevice();
</span><span class="lines">@@ -227,15 +286,19 @@
</span><span class="cx"> bool mDXT3TextureSupport;
</span><span class="cx"> bool mDXT5TextureSupport;
</span><span class="cx">
</span><ins>+ bool mRGTextureSupport;
+
</ins><span class="cx"> bool mDepthTextureSupport;
</span><span class="cx">
</span><span class="cx"> // Multisample format support
</span><span class="cx"> struct MultisampleSupportInfo
</span><span class="cx"> {
</span><span class="cx"> unsigned int qualityLevels[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT];
</span><ins>+ unsigned int maxSupportedSamples;
</ins><span class="cx"> };
</span><ins>+ MultisampleSupportInfo getMultisampleSupportInfo(DXGI_FORMAT format);
</ins><span class="cx">
</span><del>- typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo, std::hash<int> > MultisampleSupportMap;
</del><ins>+ typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo> MultisampleSupportMap;
</ins><span class="cx"> MultisampleSupportMap mMultisampleSupportMap;
</span><span class="cx">
</span><span class="cx"> unsigned int mMaxSupportedSamples;
</span><span class="lines">@@ -258,13 +321,13 @@
</span><span class="cx"> gl::SamplerState mCurPixelSamplerStates[gl::MAX_TEXTURE_IMAGE_UNITS];
</span><span class="cx">
</span><span class="cx"> // Currently applied textures
</span><del>- unsigned int mCurVertexTextureSerials[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
- unsigned int mCurPixelTextureSerials[gl::MAX_TEXTURE_IMAGE_UNITS];
</del><ins>+ ID3D11ShaderResourceView *mCurVertexSRVs[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
+ ID3D11ShaderResourceView *mCurPixelSRVs[gl::MAX_TEXTURE_IMAGE_UNITS];
</ins><span class="cx">
</span><span class="cx"> // Currently applied blend state
</span><span class="cx"> bool mForceSetBlendState;
</span><span class="cx"> gl::BlendState mCurBlendState;
</span><del>- gl::Color mCurBlendColor;
</del><ins>+ gl::ColorF mCurBlendColor;
</ins><span class="cx"> unsigned int mCurSampleMask;
</span><span class="cx">
</span><span class="cx"> // Currently applied rasterizer state
</span><span class="lines">@@ -291,22 +354,32 @@
</span><span class="cx"> // Currently applied primitive topology
</span><span class="cx"> D3D11_PRIMITIVE_TOPOLOGY mCurrentPrimitiveTopology;
</span><span class="cx">
</span><del>- unsigned int mAppliedIBSerial;
- unsigned int mAppliedStorageIBSerial;
</del><ins>+ // Currently applied index buffer
+ ID3D11Buffer *mAppliedIB;
+ DXGI_FORMAT mAppliedIBFormat;
</ins><span class="cx"> unsigned int mAppliedIBOffset;
</span><span class="cx">
</span><del>- unsigned int mAppliedProgramBinarySerial;
- bool mIsGeometryShaderActive;
</del><ins>+ // Currently applied transform feedback buffers
+ ID3D11Buffer *mAppliedTFBuffers[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
+ GLintptr mAppliedTFOffsets[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
</ins><span class="cx">
</span><ins>+ // Currently applied shaders
+ ID3D11VertexShader *mAppliedVertexShader;
+ ID3D11GeometryShader *mAppliedGeometryShader;
+ ID3D11GeometryShader *mCurPointGeometryShader;
+ ID3D11PixelShader *mAppliedPixelShader;
+
</ins><span class="cx"> dx_VertexConstants mVertexConstants;
</span><span class="cx"> dx_VertexConstants mAppliedVertexConstants;
</span><span class="cx"> ID3D11Buffer *mDriverConstantBufferVS;
</span><span class="cx"> ID3D11Buffer *mCurrentVertexConstantBuffer;
</span><ins>+ unsigned int mCurrentConstantBufferVS[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
</ins><span class="cx">
</span><span class="cx"> dx_PixelConstants mPixelConstants;
</span><span class="cx"> dx_PixelConstants mAppliedPixelConstants;
</span><span class="cx"> ID3D11Buffer *mDriverConstantBufferPS;
</span><span class="cx"> ID3D11Buffer *mCurrentPixelConstantBuffer;
</span><ins>+ unsigned int mCurrentConstantBufferPS[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
</ins><span class="cx">
</span><span class="cx"> ID3D11Buffer *mCurrentGeometryConstantBuffer;
</span><span class="cx">
</span><span class="lines">@@ -319,25 +392,11 @@
</span><span class="cx"> StreamingIndexBufferInterface *mTriangleFanIB;
</span><span class="cx">
</span><span class="cx"> // Texture copy resources
</span><del>- bool mCopyResourcesInitialized;
- ID3D11Buffer *mCopyVB;
- ID3D11SamplerState *mCopySampler;
- ID3D11InputLayout *mCopyIL;
- ID3D11VertexShader *mCopyVS;
- ID3D11PixelShader *mCopyRGBAPS;
- ID3D11PixelShader *mCopyRGBPS;
- ID3D11PixelShader *mCopyLumPS;
- ID3D11PixelShader *mCopyLumAlphaPS;
</del><ins>+ Blit11 *mBlit;
+ PixelTransfer11 *mPixelTransfer;
</ins><span class="cx">
</span><span class="cx"> // Masked clear resources
</span><del>- bool mClearResourcesInitialized;
- ID3D11Buffer *mClearVB;
- ID3D11InputLayout *mClearIL;
- ID3D11VertexShader *mClearVS;
- ID3D11PixelShader *mClearSinglePS;
- ID3D11PixelShader *mClearMultiplePS;
- ID3D11RasterizerState *mClearScissorRS;
- ID3D11RasterizerState *mClearNoScissorRS;
</del><ins>+ Clear11 *mClear;
</ins><span class="cx">
</span><span class="cx"> // Sync query
</span><span class="cx"> ID3D11Query *mSyncQuery;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11ShaderExecutable11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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">@@ -10,7 +10,7 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/ShaderExecutable11.h"
</span><span class="cx">
</span><del>-#include "common/debug.h"
</del><ins>+#include "libGLESv2/renderer/d3d11/Renderer11.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -21,18 +21,16 @@
</span><span class="cx"> mPixelExecutable = executable;
</span><span class="cx"> mVertexExecutable = NULL;
</span><span class="cx"> mGeometryExecutable = NULL;
</span><del>-
- mConstantBuffer = NULL;
</del><ins>+ mStreamOutExecutable = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable)
</del><ins>+ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable, ID3D11GeometryShader *streamOut)
</ins><span class="cx"> : ShaderExecutable(function, length)
</span><span class="cx"> {
</span><span class="cx"> mVertexExecutable = executable;
</span><span class="cx"> mPixelExecutable = NULL;
</span><span class="cx"> mGeometryExecutable = NULL;
</span><del>-
- mConstantBuffer = NULL;
</del><ins>+ mStreamOutExecutable = streamOut;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11GeometryShader *executable)
</span><span class="lines">@@ -41,29 +39,15 @@
</span><span class="cx"> mGeometryExecutable = executable;
</span><span class="cx"> mVertexExecutable = NULL;
</span><span class="cx"> mPixelExecutable = NULL;
</span><del>-
- mConstantBuffer = NULL;
</del><ins>+ mStreamOutExecutable = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ShaderExecutable11::~ShaderExecutable11()
</span><span class="cx"> {
</span><del>- if (mVertexExecutable)
- {
- mVertexExecutable->Release();
- }
- if (mPixelExecutable)
- {
- mPixelExecutable->Release();
- }
- if (mGeometryExecutable)
- {
- mGeometryExecutable->Release();
- }
-
- if (mConstantBuffer)
- {
- mConstantBuffer->Release();
- }
</del><ins>+ SafeRelease(mVertexExecutable);
+ SafeRelease(mPixelExecutable);
+ SafeRelease(mGeometryExecutable);
+ SafeRelease(mStreamOutExecutable);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable *executable)
</span><span class="lines">@@ -87,23 +71,41 @@
</span><span class="cx"> return mGeometryExecutable;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ID3D11Buffer *ShaderExecutable11::getConstantBuffer(ID3D11Device *device, unsigned int registerCount)
</del><ins>+ID3D11GeometryShader *ShaderExecutable11::getStreamOutShader() const
</ins><span class="cx"> {
</span><del>- if (!mConstantBuffer && registerCount > 0)
</del><ins>+ return mStreamOutExecutable;
+}
+
+UniformStorage11::UniformStorage11(Renderer11 *renderer, size_t initialSize)
+ : UniformStorage(initialSize),
+ mConstantBuffer(NULL)
+{
+ ID3D11Device *d3d11Device = renderer->getDevice();
+
+ if (initialSize > 0)
</ins><span class="cx"> {
</span><span class="cx"> D3D11_BUFFER_DESC constantBufferDescription = {0};
</span><del>- constantBufferDescription.ByteWidth = registerCount * sizeof(float[4]);
</del><ins>+ constantBufferDescription.ByteWidth = initialSize;
</ins><span class="cx"> constantBufferDescription.Usage = D3D11_USAGE_DYNAMIC;
</span><span class="cx"> constantBufferDescription.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
</span><span class="cx"> constantBufferDescription.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
</span><span class="cx"> constantBufferDescription.MiscFlags = 0;
</span><span class="cx"> constantBufferDescription.StructureByteStride = 0;
</span><span class="cx">
</span><del>- HRESULT result = device->CreateBuffer(&constantBufferDescription, NULL, &mConstantBuffer);
</del><ins>+ HRESULT result = d3d11Device->CreateBuffer(&constantBufferDescription, NULL, &mConstantBuffer);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- return mConstantBuffer;
</del><ins>+UniformStorage11::~UniformStorage11()
+{
+ SafeRelease(mConstantBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+const UniformStorage11 *UniformStorage11::makeUniformStorage11(const UniformStorage *uniformStorage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(const UniformStorage11*, uniformStorage));
+ return static_cast<const UniformStorage11*>(uniformStorage);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11ShaderExecutable11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/ShaderExecutable11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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">@@ -14,12 +14,14 @@
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><ins>+class Renderer11;
+class UniformStorage11;
</ins><span class="cx">
</span><span class="cx"> class ShaderExecutable11 : public ShaderExecutable
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx"> ShaderExecutable11(const void *function, size_t length, ID3D11PixelShader *executable);
</span><del>- ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable);
</del><ins>+ ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable, ID3D11GeometryShader *streamOut);
</ins><span class="cx"> ShaderExecutable11(const void *function, size_t length, ID3D11GeometryShader *executable);
</span><span class="cx">
</span><span class="cx"> virtual ~ShaderExecutable11();
</span><span class="lines">@@ -29,16 +31,28 @@
</span><span class="cx"> ID3D11PixelShader *getPixelShader() const;
</span><span class="cx"> ID3D11VertexShader *getVertexShader() const;
</span><span class="cx"> ID3D11GeometryShader *getGeometryShader() const;
</span><ins>+ ID3D11GeometryShader *getStreamOutShader() const;
</ins><span class="cx">
</span><del>- ID3D11Buffer *getConstantBuffer(ID3D11Device *device, unsigned int registerCount);
-
</del><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11);
</span><span class="cx">
</span><span class="cx"> ID3D11PixelShader *mPixelExecutable;
</span><span class="cx"> ID3D11VertexShader *mVertexExecutable;
</span><span class="cx"> ID3D11GeometryShader *mGeometryExecutable;
</span><ins>+ ID3D11GeometryShader *mStreamOutExecutable;
+};
</ins><span class="cx">
</span><ins>+class UniformStorage11 : public UniformStorage
+{
+ public:
+ UniformStorage11(Renderer11 *renderer, size_t initialSize);
+ virtual ~UniformStorage11();
+
+ static const UniformStorage11 *makeUniformStorage11(const UniformStorage *uniformStorage);
+
+ ID3D11Buffer *getConstantBuffer() const { return mConstantBuffer; }
+
+ private:
</ins><span class="cx"> ID3D11Buffer *mConstantBuffer;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11SwapChain11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,11 +10,11 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/SwapChain11.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d11/Renderer11.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough2d11vs.h"
+#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
</ins><span class="cx">
</span><del>-#include "libGLESv2/renderer/d3d11/shaders/compiled/passthrough11vs.h"
-#include "libGLESv2/renderer/d3d11/shaders/compiled/passthroughrgba11ps.h"
-
</del><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> mOffscreenSRView = NULL;
</span><span class="cx"> mDepthStencilTexture = NULL;
</span><span class="cx"> mDepthStencilDSView = NULL;
</span><ins>+ mDepthStencilSRView = NULL;
</ins><span class="cx"> mQuadVB = NULL;
</span><span class="cx"> mPassThroughSampler = NULL;
</span><span class="cx"> mPassThroughIL = NULL;
</span><span class="lines">@@ -57,6 +58,7 @@
</span><span class="cx"> SafeRelease(mOffscreenSRView);
</span><span class="cx"> SafeRelease(mDepthStencilTexture);
</span><span class="cx"> SafeRelease(mDepthStencilDSView);
</span><ins>+ SafeRelease(mDepthStencilSRView);
</ins><span class="cx"> SafeRelease(mQuadVB);
</span><span class="cx"> SafeRelease(mPassThroughSampler);
</span><span class="cx"> SafeRelease(mPassThroughIL);
</span><span class="lines">@@ -76,6 +78,7 @@
</span><span class="cx"> SafeRelease(mOffscreenSRView);
</span><span class="cx"> SafeRelease(mDepthStencilTexture);
</span><span class="cx"> SafeRelease(mDepthStencilDSView);
</span><ins>+ SafeRelease(mDepthStencilSRView);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHeight)
</span><span class="lines">@@ -114,7 +117,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> result = tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)&mOffscreenTexture);
</span><del>- tempResource11->Release();
</del><ins>+ SafeRelease(tempResource11);
</ins><span class="cx">
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="lines">@@ -129,7 +132,7 @@
</span><span class="cx">
</span><span class="cx"> if (offscreenTextureDesc.Width != (UINT)backbufferWidth
</span><span class="cx"> || offscreenTextureDesc.Height != (UINT)backbufferHeight
</span><del>- || offscreenTextureDesc.Format != gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat)
</del><ins>+ || offscreenTextureDesc.Format != gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion())
</ins><span class="cx"> || offscreenTextureDesc.MipLevels != 1
</span><span class="cx"> || offscreenTextureDesc.ArraySize != 1)
</span><span class="cx"> {
</span><span class="lines">@@ -145,7 +148,7 @@
</span><span class="cx"> D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
</span><span class="cx"> offscreenTextureDesc.Width = backbufferWidth;
</span><span class="cx"> offscreenTextureDesc.Height = backbufferHeight;
</span><del>- offscreenTextureDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
</del><ins>+ offscreenTextureDesc.Format = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
</ins><span class="cx"> offscreenTextureDesc.MipLevels = 1;
</span><span class="cx"> offscreenTextureDesc.ArraySize = 1;
</span><span class="cx"> offscreenTextureDesc.SampleDesc.Count = 1;
</span><span class="lines">@@ -172,7 +175,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- d3d11::SetDebugName(mOffscreenTexture, "Offscreen texture");
</del><ins>+ d3d11::SetDebugName(mOffscreenTexture, "Offscreen back buffer texture");
</ins><span class="cx">
</span><span class="cx"> // EGL_ANGLE_surface_d3d_texture_2d_share_handle requires that we store a share handle for the client
</span><span class="cx"> if (useSharedResource)
</span><span class="lines">@@ -188,7 +191,7 @@
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="cx"> result = offscreenTextureResource->GetSharedHandle(&mShareHandle);
</span><del>- offscreenTextureResource->Release();
</del><ins>+ SafeRelease(offscreenTextureResource);
</ins><span class="cx">
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="lines">@@ -198,32 +201,43 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
- HRESULT result = device->CreateRenderTargetView(mOffscreenTexture, NULL, &mOffscreenRTView);
</del><span class="cx">
</span><ins>+
+ D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc;
+ offscreenRTVDesc.Format = gl_d3d11::GetRTVFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
+ offscreenRTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ offscreenRTVDesc.Texture2D.MipSlice = 0;
+
+ HRESULT result = device->CreateRenderTargetView(mOffscreenTexture, &offscreenRTVDesc, &mOffscreenRTView);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><del>- d3d11::SetDebugName(mOffscreenRTView, "Offscreen render target");
</del><ins>+ d3d11::SetDebugName(mOffscreenRTView, "Offscreen back buffer render target");
</ins><span class="cx">
</span><del>- result = device->CreateShaderResourceView(mOffscreenTexture, NULL, &mOffscreenSRView);
</del><ins>+ D3D11_SHADER_RESOURCE_VIEW_DESC offscreenSRVDesc;
+ offscreenSRVDesc.Format = gl_d3d11::GetSRVFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
+ offscreenSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ offscreenSRVDesc.Texture2D.MostDetailedMip = 0;
+ offscreenSRVDesc.Texture2D.MipLevels = -1;
+
+ result = device->CreateShaderResourceView(mOffscreenTexture, &offscreenSRVDesc, &mOffscreenSRView);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><del>- d3d11::SetDebugName(mOffscreenSRView, "Offscreen shader resource");
</del><ins>+ d3d11::SetDebugName(mOffscreenSRView, "Offscreen back buffer shader resource");
</ins><span class="cx">
</span><span class="cx"> if (mDepthBufferFormat != GL_NONE)
</span><span class="cx"> {
</span><del>- D3D11_TEXTURE2D_DESC depthStencilDesc = {0};
- depthStencilDesc.Width = backbufferWidth;
- depthStencilDesc.Height = backbufferHeight;
- depthStencilDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mDepthBufferFormat);
- depthStencilDesc.MipLevels = 1;
- depthStencilDesc.ArraySize = 1;
- depthStencilDesc.SampleDesc.Count = 1;
- depthStencilDesc.SampleDesc.Quality = 0;
- depthStencilDesc.Usage = D3D11_USAGE_DEFAULT;
- depthStencilDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
- depthStencilDesc.CPUAccessFlags = 0;
- depthStencilDesc.MiscFlags = 0;
</del><ins>+ D3D11_TEXTURE2D_DESC depthStencilTextureDesc;
+ depthStencilTextureDesc.Width = backbufferWidth;
+ depthStencilTextureDesc.Height = backbufferHeight;
+ depthStencilTextureDesc.Format = gl_d3d11::GetTexFormat(mDepthBufferFormat, mRenderer->getCurrentClientVersion());
+ 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 | D3D11_BIND_SHADER_RESOURCE;
+ depthStencilTextureDesc.CPUAccessFlags = 0;
+ depthStencilTextureDesc.MiscFlags = 0;
</ins><span class="cx">
</span><del>- result = device->CreateTexture2D(&depthStencilDesc, NULL, &mDepthStencilTexture);
</del><ins>+ result = device->CreateTexture2D(&depthStencilTextureDesc, NULL, &mDepthStencilTexture);
</ins><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ERR("Could not create depthstencil surface for new swap chain: 0x%08X", result);
</span><span class="lines">@@ -238,11 +252,27 @@
</span><span class="cx"> return EGL_BAD_ALLOC;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- d3d11::SetDebugName(mDepthStencilTexture, "Depth stencil texture");
</del><ins>+ d3d11::SetDebugName(mDepthStencilTexture, "Offscreen depth stencil texture");
</ins><span class="cx">
</span><del>- result = device->CreateDepthStencilView(mDepthStencilTexture, NULL, &mDepthStencilDSView);
</del><ins>+ D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilDesc;
+ depthStencilDesc.Format = gl_d3d11::GetDSVFormat(mDepthBufferFormat, mRenderer->getCurrentClientVersion());
+ depthStencilDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+ depthStencilDesc.Flags = 0;
+ depthStencilDesc.Texture2D.MipSlice = 0;
+
+ result = device->CreateDepthStencilView(mDepthStencilTexture, &depthStencilDesc, &mDepthStencilDSView);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><del>- d3d11::SetDebugName(mDepthStencilDSView, "Depth stencil view");
</del><ins>+ d3d11::SetDebugName(mDepthStencilDSView, "Offscreen depth stencil view");
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC depthStencilSRVDesc;
+ depthStencilSRVDesc.Format = gl_d3d11::GetSRVFormat(mDepthBufferFormat, mRenderer->getCurrentClientVersion());
+ depthStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ depthStencilSRVDesc.Texture2D.MostDetailedMip = 0;
+ depthStencilSRVDesc.Texture2D.MipLevels = -1;
+
+ result = device->CreateShaderResourceView(mDepthStencilTexture, &depthStencilSRVDesc, &mDepthStencilSRView);
+ ASSERT(SUCCEEDED(result));
+ d3d11::SetDebugName(mDepthStencilSRView, "Offscreen depth stencil shader resource");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mWidth = backbufferWidth;
</span><span class="lines">@@ -262,7 +292,7 @@
</span><span class="cx"> const int yoffset = std::max(mHeight - previousHeight, 0);
</span><span class="cx"> deviceContext->CopySubresourceRegion(mOffscreenTexture, 0, 0, yoffset, 0, previousOffscreenTexture, 0, &sourceBox);
</span><span class="cx">
</span><del>- previousOffscreenTexture->Release();
</del><ins>+ SafeRelease(previousOffscreenTexture);
</ins><span class="cx">
</span><span class="cx"> if (mSwapChain)
</span><span class="cx"> {
</span><span class="lines">@@ -295,7 +325,7 @@
</span><span class="cx"> SafeRelease(mBackBufferRTView);
</span><span class="cx">
</span><span class="cx"> // Resize swap chain
</span><del>- DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
</del><ins>+ DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
</ins><span class="cx"> HRESULT result = mSwapChain->ResizeBuffers(2, backbufferWidth, backbufferHeight, backbufferDXGIFormat, 0);
</span><span class="cx">
</span><span class="cx"> if (FAILED(result))
</span><span class="lines">@@ -365,7 +395,7 @@
</span><span class="cx">
</span><span class="cx"> DXGI_SWAP_CHAIN_DESC swapChainDesc = {0};
</span><span class="cx"> swapChainDesc.BufferCount = 2;
</span><del>- swapChainDesc.BufferDesc.Format = gl_d3d11::ConvertRenderbufferFormat(mBackBufferFormat);
</del><ins>+ swapChainDesc.BufferDesc.Format = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
</ins><span class="cx"> swapChainDesc.BufferDesc.Width = backbufferWidth;
</span><span class="cx"> swapChainDesc.BufferDesc.Height = backbufferHeight;
</span><span class="cx"> swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
</span><span class="lines">@@ -462,15 +492,15 @@
</span><span class="cx"> { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
</span><span class="cx"> };
</span><span class="cx">
</span><del>- result = device->CreateInputLayout(quadLayout, 2, g_VS_Passthrough, sizeof(g_VS_Passthrough), &mPassThroughIL);
</del><ins>+ result = device->CreateInputLayout(quadLayout, 2, g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), &mPassThroughIL);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> d3d11::SetDebugName(mPassThroughIL, "Swap chain pass through layout");
</span><span class="cx">
</span><del>- result = device->CreateVertexShader(g_VS_Passthrough, sizeof(g_VS_Passthrough), NULL, &mPassThroughVS);
</del><ins>+ result = device->CreateVertexShader(g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), NULL, &mPassThroughVS);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> d3d11::SetDebugName(mPassThroughVS, "Swap chain pass through vertex shader");
</span><span class="cx">
</span><del>- result = device->CreatePixelShader(g_PS_PassthroughRGBA, sizeof(g_PS_PassthroughRGBA), NULL, &mPassThroughPS);
</del><ins>+ result = device->CreatePixelShader(g_PS_PassthroughRGBA2D, sizeof(g_PS_PassthroughRGBA2D), NULL, &mPassThroughPS);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> d3d11::SetDebugName(mPassThroughPS, "Swap chain pass through pixel shader");
</span><span class="cx"> }
</span><span class="lines">@@ -585,61 +615,33 @@
</span><span class="cx"> return EGL_SUCCESS;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Increments refcount on texture.
-// caller must Release() the returned texture
</del><span class="cx"> ID3D11Texture2D *SwapChain11::getOffscreenTexture()
</span><span class="cx"> {
</span><del>- if (mOffscreenTexture)
- {
- mOffscreenTexture->AddRef();
- }
-
</del><span class="cx"> return mOffscreenTexture;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Increments refcount on view.
-// caller must Release() the returned view
</del><span class="cx"> ID3D11RenderTargetView *SwapChain11::getRenderTarget()
</span><span class="cx"> {
</span><del>- if (mOffscreenRTView)
- {
- mOffscreenRTView->AddRef();
- }
-
</del><span class="cx"> return mOffscreenRTView;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Increments refcount on view.
-// caller must Release() the returned view
</del><span class="cx"> ID3D11ShaderResourceView *SwapChain11::getRenderTargetShaderResource()
</span><span class="cx"> {
</span><del>- if (mOffscreenSRView)
- {
- mOffscreenSRView->AddRef();
- }
-
</del><span class="cx"> return mOffscreenSRView;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Increments refcount on view.
-// caller must Release() the returned view
</del><span class="cx"> ID3D11DepthStencilView *SwapChain11::getDepthStencil()
</span><span class="cx"> {
</span><del>- if (mDepthStencilDSView)
- {
- mDepthStencilDSView->AddRef();
- }
-
</del><span class="cx"> return mDepthStencilDSView;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ID3D11ShaderResourceView * SwapChain11::getDepthStencilShaderResource()
+{
+ return mDepthStencilSRView;
+}
+
</ins><span class="cx"> ID3D11Texture2D *SwapChain11::getDepthStencilTexture()
</span><span class="cx"> {
</span><del>- if (mDepthStencilTexture)
- {
- mDepthStencilTexture->AddRef();
- }
-
</del><span class="cx"> return mDepthStencilTexture;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11SwapChain11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/SwapChain11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">
</span><span class="cx"> virtual ID3D11Texture2D *getDepthStencilTexture();
</span><span class="cx"> virtual ID3D11DepthStencilView *getDepthStencil();
</span><ins>+ virtual ID3D11ShaderResourceView *getDepthStencilShaderResource();
</ins><span class="cx">
</span><span class="cx"> EGLint getWidth() const { return mWidth; }
</span><span class="cx"> EGLint getHeight() const { return mHeight; }
</span><span class="lines">@@ -66,6 +67,7 @@
</span><span class="cx">
</span><span class="cx"> ID3D11Texture2D *mDepthStencilTexture;
</span><span class="cx"> ID3D11DepthStencilView *mDepthStencilDSView;
</span><ins>+ ID3D11ShaderResourceView *mDepthStencilSRView;
</ins><span class="cx">
</span><span class="cx"> ID3D11Buffer *mQuadVB;
</span><span class="cx"> ID3D11SamplerState *mPassThroughSampler;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11TextureStorage11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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">@@ -14,31 +14,105 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/RenderTarget11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/SwapChain11.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d11/Blit11.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx">
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "common/utilities.h"
</ins><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><ins>+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 &other) const
+{
+ return swizzleRed == other.swizzleRed &&
+ swizzleGreen == other.swizzleGreen &&
+ swizzleBlue == other.swizzleBlue &&
+ swizzleAlpha == other.swizzleAlpha;
+}
+
+bool TextureStorage11::SwizzleCacheValue::operator!=(const SwizzleCacheValue &other) const
+{
+ return !(*this == other);
+}
+
+TextureStorage11::SRVKey::SRVKey(int baseLevel, int mipLevels, bool swizzle)
+ : baseLevel(baseLevel), mipLevels(mipLevels), swizzle(swizzle)
+{
+}
+
+bool TextureStorage11::SRVKey::operator==(const SRVKey &rhs) const
+{
+ return baseLevel == rhs.baseLevel &&
+ mipLevels == rhs.mipLevels &&
+ swizzle == rhs.swizzle;
+}
+
+TextureStorage11::SRVCache::~SRVCache()
+{
+ for (size_t i = 0; i < cache.size(); i++)
+ {
+ SafeRelease(cache[i].srv);
+ }
+}
+
+ID3D11ShaderResourceView *TextureStorage11::SRVCache::find(const SRVKey &key) const
+{
+ for (size_t i = 0; i < cache.size(); i++)
+ {
+ if (cache[i].key == key)
+ {
+ return cache[i].srv;
+ }
+ }
+
+ return NULL;
+}
+
+ID3D11ShaderResourceView *TextureStorage11::SRVCache::add(const SRVKey &key, ID3D11ShaderResourceView *srv)
+{
+ SRVPair pair = {key, srv};
+ cache.push_back(pair);
+
+ return srv;
+}
+
</ins><span class="cx"> TextureStorage11::TextureStorage11(Renderer *renderer, UINT bindFlags)
</span><span class="cx"> : mBindFlags(bindFlags),
</span><del>- mLodOffset(0),
</del><ins>+ mTopLevel(0),
</ins><span class="cx"> mMipLevels(0),
</span><del>- mTexture(NULL),
</del><span class="cx"> mTextureFormat(DXGI_FORMAT_UNKNOWN),
</span><span class="cx"> mShaderResourceFormat(DXGI_FORMAT_UNKNOWN),
</span><span class="cx"> mRenderTargetFormat(DXGI_FORMAT_UNKNOWN),
</span><span class="cx"> mDepthStencilFormat(DXGI_FORMAT_UNKNOWN),
</span><del>- mSRV(NULL),
</del><span class="cx"> mTextureWidth(0),
</span><del>- mTextureHeight(0)
</del><ins>+ mTextureHeight(0),
+ mTextureDepth(0)
</ins><span class="cx"> {
</span><span class="cx"> mRenderer = Renderer11::makeRenderer11(renderer);
</span><ins>+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mLevelSRVs[i] = NULL;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorage11::~TextureStorage11()
</span><span class="cx"> {
</span><ins>+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ SafeRelease(mLevelSRVs[level]);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorage11 *TextureStorage11::makeTextureStorage11(TextureStorage *storage)
</span><span class="lines">@@ -47,116 +121,217 @@
</span><span class="cx"> return static_cast<TextureStorage11*>(storage);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-DWORD TextureStorage11::GetTextureBindFlags(DXGI_FORMAT format, GLenum glusage, bool forceRenderable)
</del><ins>+DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat, GLuint clientVersion, bool renderTarget)
</ins><span class="cx"> {
</span><del>- UINT bindFlags = D3D11_BIND_SHADER_RESOURCE;
-
- if (d3d11::IsDepthStencilFormat(format))
</del><ins>+ UINT bindFlags = 0;
+
+ if (gl_d3d11::GetSRVFormat(internalFormat, clientVersion) != DXGI_FORMAT_UNKNOWN)
</ins><span class="cx"> {
</span><ins>+ bindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ }
+ if (gl_d3d11::GetDSVFormat(internalFormat, clientVersion) != DXGI_FORMAT_UNKNOWN)
+ {
</ins><span class="cx"> bindFlags |= D3D11_BIND_DEPTH_STENCIL;
</span><span class="cx"> }
</span><del>- else if(forceRenderable || (TextureStorage11::IsTextureFormatRenderable(format) && (glusage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE)))
</del><ins>+ if (gl_d3d11::GetRTVFormat(internalFormat, clientVersion) != DXGI_FORMAT_UNKNOWN && renderTarget)
</ins><span class="cx"> {
</span><span class="cx"> bindFlags |= D3D11_BIND_RENDER_TARGET;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> return bindFlags;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool TextureStorage11::IsTextureFormatRenderable(DXGI_FORMAT format)
</del><ins>+UINT TextureStorage11::getBindFlags() const
</ins><span class="cx"> {
</span><del>- switch(format)
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- case DXGI_FORMAT_A8_UNORM:
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- case DXGI_FORMAT_R8_UNORM:
- case DXGI_FORMAT_R8G8_UNORM:
- case DXGI_FORMAT_R16_FLOAT:
- case DXGI_FORMAT_R16G16_FLOAT:
- return true;
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_R32G32B32_FLOAT: // not renderable on all devices
- return false;
- default:
- UNREACHABLE();
- return false;
- }
</del><ins>+ return mBindFlags;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-UINT TextureStorage11::getBindFlags() const
</del><ins>+int TextureStorage11::getTopLevel() const
</ins><span class="cx"> {
</span><del>- return mBindFlags;
</del><ins>+ return mTopLevel;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-ID3D11Texture2D *TextureStorage11::getBaseTexture() const
</del><ins>+bool TextureStorage11::isRenderTarget() const
</ins><span class="cx"> {
</span><del>- return mTexture;
</del><ins>+ return (mBindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL)) != 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-int TextureStorage11::getLodOffset() const
</del><ins>+bool TextureStorage11::isManaged() const
</ins><span class="cx"> {
</span><del>- return mLodOffset;
</del><ins>+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool TextureStorage11::isRenderTarget() const
</del><ins>+int TextureStorage11::getLevelCount() const
</ins><span class="cx"> {
</span><del>- return (mBindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL)) != 0;
</del><ins>+ return mMipLevels - mTopLevel;
</ins><span class="cx"> }
</span><ins>+
+int TextureStorage11::getLevelWidth(int mipLevel) const
+{
+ return std::max(static_cast<int>(mTextureWidth) >> mipLevel, 1);
+}
+
+int TextureStorage11::getLevelHeight(int mipLevel) const
+{
+ return std::max(static_cast<int>(mTextureHeight) >> mipLevel, 1);
+}
+
+int TextureStorage11::getLevelDepth(int mipLevel) const
+{
+ return std::max(static_cast<int>(mTextureDepth) >> mipLevel, 1);
+}
+
+UINT TextureStorage11::getSubresourceIndex(int mipLevel, int layerTarget) const
+{
+ UINT index = 0;
+ if (getResource())
+ {
+ index = D3D11CalcSubresource(mipLevel, layerTarget, mMipLevels);
+ }
+ return index;
+}
+
+ID3D11ShaderResourceView *TextureStorage11::getSRV(const gl::SamplerState &samplerState)
+{
+ bool swizzleRequired = samplerState.swizzleRequired();
+ bool mipmapping = gl::IsMipmapFiltered(samplerState);
+ unsigned int mipLevels = mipmapping ? (samplerState.maxLevel - samplerState.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 - samplerState.baseLevel);
+
+ if (swizzleRequired)
+ {
+ verifySwizzleExists(samplerState.swizzleRed, samplerState.swizzleGreen, samplerState.swizzleBlue, samplerState.swizzleAlpha);
+ }
</ins><span class="cx">
</span><del>-bool TextureStorage11::isManaged() const
</del><ins>+ SRVKey key(samplerState.baseLevel, mipLevels, swizzleRequired);
+ ID3D11ShaderResourceView *srv = srvCache.find(key);
+
+ if(srv)
+ {
+ return srv;
+ }
+
+ DXGI_FORMAT format = (swizzleRequired ? mSwizzleShaderResourceFormat : mShaderResourceFormat);
+ ID3D11Resource *texture = swizzleRequired ? getSwizzleTexture() : getResource();
+
+ srv = createSRV(samplerState.baseLevel, mipLevels, format, texture);
+
+ return srvCache.add(key, srv);
+}
+
+ID3D11ShaderResourceView *TextureStorage11::getSRVLevel(int mipLevel)
</ins><span class="cx"> {
</span><del>- return false;
</del><ins>+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mLevelSRVs[mipLevel])
+ {
+ mLevelSRVs[mipLevel] = createSRV(mipLevel, 1, mShaderResourceFormat, getResource());
+ }
+
+ return mLevelSRVs[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-int TextureStorage11::levelCount()
</del><ins>+void TextureStorage11::generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
</ins><span class="cx"> {
</span><del>- int levels = 0;
- if (getBaseTexture())
</del><ins>+ SwizzleCacheValue swizzleTarget(swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha);
+ for (int level = 0; level < getLevelCount(); level++)
</ins><span class="cx"> {
</span><del>- levels = mMipLevels - getLodOffset();
</del><ins>+ // 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 = getSRVLevel(level);
+ ID3D11RenderTargetView *destRTV = getSwizzleRenderTarget(level);
+
+ gl::Extents size(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+
+ Blit11 *blitter = mRenderer->getBlitter();
+
+ if (blitter->swizzleTexture(sourceSRV, destRTV, size, swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha))
+ {
+ mSwizzleCache[level] = swizzleTarget;
+ }
+ else
+ {
+ ERR("Failed to swizzle texture.");
+ }
+ }
</ins><span class="cx"> }
</span><del>- return levels;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-UINT TextureStorage11::getSubresourceIndex(int level, int faceIndex)
</del><ins>+void TextureStorage11::invalidateSwizzleCacheLevel(int mipLevel)
</ins><span class="cx"> {
</span><del>- UINT index = 0;
- if (getBaseTexture())
</del><ins>+ if (mipLevel >= 0 && static_cast<unsigned int>(mipLevel) < ArraySize(mSwizzleCache))
</ins><span class="cx"> {
</span><del>- index = D3D11CalcSubresource(level, faceIndex, mMipLevels);
</del><ins>+ // The default constructor of SwizzleCacheValue has GL_NONE for all channels which is not a
+ // valid swizzle combination
+ mSwizzleCache[mipLevel] = SwizzleCacheValue();
</ins><span class="cx"> }
</span><del>- return index;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-bool TextureStorage11::updateSubresourceLevel(ID3D11Texture2D *srcTexture, unsigned int sourceSubresource,
- int level, int face, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height)
</del><ins>+void TextureStorage11::invalidateSwizzleCache()
</ins><span class="cx"> {
</span><ins>+ for (unsigned int mipLevel = 0; mipLevel < ArraySize(mSwizzleCache); mipLevel++)
+ {
+ invalidateSwizzleCacheLevel(mipLevel);
+ }
+}
+
+bool TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture, unsigned int sourceSubresource,
+ int level, int layerTarget, GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth)
+{
</ins><span class="cx"> if (srcTexture)
</span><span class="cx"> {
</span><del>- // Round up the width and height to the nearest multiple of dimension alignment
- unsigned int dimensionAlignment = d3d11::GetTextureFormatDimensionAlignment(mTextureFormat);
- width = width + dimensionAlignment - 1 - (width - 1) % dimensionAlignment;
- height = height + dimensionAlignment - 1 - (height - 1) % dimensionAlignment;
</del><ins>+ invalidateSwizzleCacheLevel(level);
</ins><span class="cx">
</span><del>- D3D11_BOX srcBox;
- srcBox.left = xoffset;
- srcBox.top = yoffset;
- srcBox.right = xoffset + width;
- srcBox.bottom = yoffset + height;
- srcBox.front = 0;
- srcBox.back = 1;
</del><ins>+ gl::Extents texSize(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+ gl::Box copyArea(xoffset, yoffset, zoffset, width, height, depth);
</ins><span class="cx">
</span><del>- ID3D11DeviceContext *context = mRenderer->getDeviceContext();
-
- ASSERT(getBaseTexture());
- context->CopySubresourceRegion(getBaseTexture(), getSubresourceIndex(level + mLodOffset, face),
- xoffset, yoffset, 0, srcTexture, sourceSubresource, &srcBox);
- return true;
</del><ins>+ bool fullCopy = copyArea.x == 0 &&
+ copyArea.y == 0 &&
+ copyArea.z == 0 &&
+ copyArea.width == texSize.width &&
+ copyArea.height == texSize.height &&
+ copyArea.depth == texSize.depth;
+
+ ID3D11Resource *dstTexture = getResource();
+ unsigned int dstSubresource = getSubresourceIndex(level + mTopLevel, layerTarget);
+
+ ASSERT(dstTexture);
+
+ if (!fullCopy && (d3d11::GetDepthBits(mTextureFormat) > 0 || d3d11::GetStencilBits(mTextureFormat) > 0))
+ {
+ // CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
+ Blit11 *blitter = mRenderer->getBlitter();
+
+ return blitter->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((unsigned int)width, d3d11::GetBlockWidth(mTextureFormat));
+ srcBox.bottom = copyArea.y + roundUp((unsigned int)height, d3d11::GetBlockHeight(mTextureFormat));
+ srcBox.front = copyArea.z;
+ srcBox.back = copyArea.z + copyArea.depth;
+
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ context->CopySubresourceRegion(dstTexture, dstSubresource, copyArea.x, copyArea.y, copyArea.z,
+ srcTexture, sourceSubresource, fullCopy ? NULL : &srcBox);
+ return true;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return false;
</span><span class="lines">@@ -171,34 +346,41 @@
</span><span class="cx">
</span><span class="cx"> if (sourceSRV && destRTV)
</span><span class="cx"> {
</span><del>- gl::Rectangle sourceArea;
- sourceArea.x = 0;
- sourceArea.y = 0;
- sourceArea.width = source->getWidth();
- sourceArea.height = source->getHeight();
</del><ins>+ gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth());
+ gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth());
</ins><span class="cx">
</span><del>- gl::Rectangle destArea;
- destArea.x = 0;
- destArea.y = 0;
- destArea.width = dest->getWidth();
- destArea.height = dest->getHeight();
</del><ins>+ gl::Box destArea(0, 0, 0, dest->getWidth(), dest->getHeight(), dest->getDepth());
+ gl::Extents destSize(dest->getWidth(), dest->getHeight(), dest->getDepth());
</ins><span class="cx">
</span><del>- mRenderer->copyTexture(sourceSRV, sourceArea, source->getWidth(), source->getHeight(),
- destRTV, destArea, dest->getWidth(), dest->getHeight(),
- GL_RGBA);
</del><ins>+ Blit11 *blitter = mRenderer->getBlitter();
+
+ blitter->copyTexture(sourceSRV, sourceArea, sourceSize, destRTV, destArea, destSize, NULL,
+ gl::GetFormat(source->getInternalFormat(), mRenderer->getCurrentClientVersion()),
+ GL_LINEAR);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TextureStorage11::verifySwizzleExists(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
+{
+ SwizzleCacheValue swizzleTarget(swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha);
+ for (unsigned int level = 0; level < mMipLevels; level++)
+ {
+ ASSERT(mSwizzleCache[level] == swizzleTarget);
+ }
+}
+
</ins><span class="cx"> TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapchain)
</span><span class="cx"> : TextureStorage11(renderer, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE)
</span><span class="cx"> {
</span><span class="cx"> mTexture = swapchain->getOffscreenTexture();
</span><del>- mSRV = swapchain->getRenderTargetShaderResource();
</del><ins>+ mTexture->AddRef();
+ mSwizzleTexture = NULL;
</ins><span class="cx">
</span><span class="cx"> for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
</span><span class="cx"> {
</span><span class="cx"> mRenderTarget[i] = NULL;
</span><ins>+ mSwizzleRenderTargets[i] = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> D3D11_TEXTURE2D_DESC texDesc;
</span><span class="lines">@@ -207,57 +389,61 @@
</span><span class="cx"> mTextureFormat = texDesc.Format;
</span><span class="cx"> mTextureWidth = texDesc.Width;
</span><span class="cx"> mTextureHeight = texDesc.Height;
</span><ins>+ mTextureDepth = 1;
</ins><span class="cx">
</span><ins>+ ID3D11ShaderResourceView *srv = swapchain->getRenderTargetShaderResource();
</ins><span class="cx"> D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
</span><del>- mSRV->GetDesc(&srvDesc);
</del><ins>+ srv->GetDesc(&srvDesc);
</ins><span class="cx"> mShaderResourceFormat = srvDesc.Format;
</span><span class="cx">
</span><span class="cx"> ID3D11RenderTargetView* offscreenRTV = swapchain->getRenderTarget();
</span><span class="cx"> D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
</span><span class="cx"> offscreenRTV->GetDesc(&rtvDesc);
</span><span class="cx"> mRenderTargetFormat = rtvDesc.Format;
</span><del>- offscreenRTV->Release();
</del><span class="cx">
</span><ins>+ GLint internalFormat = d3d11_gl::GetInternalFormat(mTextureFormat, renderer->getCurrentClientVersion());
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalFormat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalFormat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalFormat, renderer);
+
</ins><span class="cx"> mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
</del><ins>+TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
</ins><span class="cx"> {
</span><ins>+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
</ins><span class="cx"> for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
</span><span class="cx"> {
</span><span class="cx"> mRenderTarget[i] = NULL;
</span><ins>+ mSwizzleRenderTargets[i] = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
- if (d3d11::IsDepthStencilFormat(convertedFormat))
- {
- mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
- mShaderResourceFormat = d3d11::GetDepthShaderResourceFormat(convertedFormat);
- mDepthStencilFormat = convertedFormat;
- mRenderTargetFormat = DXGI_FORMAT_UNKNOWN;
- }
- else
- {
- mTextureFormat = convertedFormat;
- mShaderResourceFormat = convertedFormat;
- mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
- mRenderTargetFormat = convertedFormat;
- }
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
</ins><span class="cx">
</span><ins>+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
</ins><span class="cx"> // if the width or height is not positive this should be treated as an incomplete texture
</span><span class="cx"> // we handle that here by skipping the d3d texture creation
</span><span class="cx"> if (width > 0 && height > 0)
</span><span class="cx"> {
</span><span class="cx"> // adjust size if needed for compressed textures
</span><del>- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &width, &height, &mLodOffset);
</del><ins>+ d3d11::MakeValidSize(false, mTextureFormat, &width, &height, &mTopLevel);
</ins><span class="cx">
</span><span class="cx"> ID3D11Device *device = mRenderer->getDevice();
</span><span class="cx">
</span><span class="cx"> D3D11_TEXTURE2D_DESC desc;
</span><span class="cx"> desc.Width = width; // Compressed texture size constraints?
</span><span class="cx"> desc.Height = height;
</span><del>- desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0;
</del><ins>+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
</ins><span class="cx"> desc.ArraySize = 1;
</span><span class="cx"> desc.Format = mTextureFormat;
</span><span class="cx"> desc.SampleDesc.Count = 1;
</span><span class="lines">@@ -287,28 +473,20 @@
</span><span class="cx"> mMipLevels = desc.MipLevels;
</span><span class="cx"> mTextureWidth = desc.Width;
</span><span class="cx"> mTextureHeight = desc.Height;
</span><ins>+ mTextureDepth = 1;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorage11_2D::~TextureStorage11_2D()
</span><span class="cx"> {
</span><del>- if (mTexture)
- {
- mTexture->Release();
- mTexture = NULL;
- }
</del><ins>+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
</ins><span class="cx">
</span><del>- if (mSRV)
- {
- mSRV->Release();
- mSRV = NULL;
- }
-
</del><span class="cx"> for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
</span><span class="cx"> {
</span><del>- delete mRenderTarget[i];
- mRenderTarget[i] = NULL;
</del><ins>+ SafeDelete(mRenderTarget[i]);
+ SafeRelease(mSwizzleRenderTargets[i]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -318,80 +496,70 @@
</span><span class="cx"> return static_cast<TextureStorage11_2D*>(storage);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ID3D11Resource *TextureStorage11_2D::getResource() const
+{
+ return mTexture;
+}
+
</ins><span class="cx"> RenderTarget *TextureStorage11_2D::getRenderTarget(int level)
</span><span class="cx"> {
</span><del>- if (level >= 0 && level < static_cast<int>(mMipLevels))
</del><ins>+ if (level >= 0 && level < getLevelCount())
</ins><span class="cx"> {
</span><span class="cx"> if (!mRenderTarget[level])
</span><span class="cx"> {
</span><del>- ID3D11Device *device = mRenderer->getDevice();
- HRESULT result;
-
- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MostDetailedMip = level;
- srvDesc.Texture2D.MipLevels = 1;
-
- ID3D11ShaderResourceView *srv;
- result = device->CreateShaderResourceView(mTexture, &srvDesc, &srv);
-
- if (result == E_OUTOFMEMORY)
</del><ins>+ ID3D11ShaderResourceView *srv = getSRVLevel(level);
+ if (!srv)
</ins><span class="cx"> {
</span><del>- return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
</del><ins>+ return NULL;
</ins><span class="cx"> }
</span><del>- ASSERT(SUCCEEDED(result));
</del><span class="cx">
</span><span class="cx"> if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
</span><span class="cx"> {
</span><ins>+ ID3D11Device *device = mRenderer->getDevice();
+
</ins><span class="cx"> D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
</span><span class="cx"> rtvDesc.Format = mRenderTargetFormat;
</span><span class="cx"> rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
</span><del>- rtvDesc.Texture2D.MipSlice = level;
</del><ins>+ rtvDesc.Texture2D.MipSlice = mTopLevel + level;
</ins><span class="cx">
</span><span class="cx"> ID3D11RenderTargetView *rtv;
</span><del>- result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
</del><ins>+ HRESULT result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
</ins><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><del>- srv->Release();
</del><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
</span><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
</del><ins>+ mRenderTarget[level] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
</ins><span class="cx">
</span><del>- mRenderTarget[level] = new RenderTarget11(mRenderer, rtv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
</del><ins>+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
</ins><span class="cx"> }
</span><span class="cx"> else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
</span><span class="cx"> {
</span><ins>+ ID3D11Device *device = mRenderer->getDevice();
+
</ins><span class="cx"> D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
</span><span class="cx"> dsvDesc.Format = mDepthStencilFormat;
</span><span class="cx"> dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
</span><del>- dsvDesc.Texture2D.MipSlice = level;
</del><ins>+ dsvDesc.Texture2D.MipSlice = mTopLevel + level;
</ins><span class="cx"> dsvDesc.Flags = 0;
</span><span class="cx">
</span><span class="cx"> ID3D11DepthStencilView *dsv;
</span><del>- result = device->CreateDepthStencilView(mTexture, &dsvDesc, &dsv);
</del><ins>+ HRESULT result = device->CreateDepthStencilView(mTexture, &dsvDesc, &dsv);
</ins><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><del>- srv->Release();
</del><ins>+ SafeRelease(srv);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
</span><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
</del><ins>+ mRenderTarget[level] = new RenderTarget11(mRenderer, dsv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
</ins><span class="cx">
</span><del>- mRenderTarget[level] = new RenderTarget11(mRenderer, dsv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
</del><ins>+ // RenderTarget will take ownership of these resources
+ SafeRelease(dsv);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -407,79 +575,148 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ID3D11ShaderResourceView *TextureStorage11_2D::getSRV()
</del><ins>+ID3D11ShaderResourceView *TextureStorage11_2D::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
</ins><span class="cx"> {
</span><del>- if (!mSRV)
- {
- ID3D11Device *device = mRenderer->getDevice();
</del><ins>+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2D.MipLevels = mipLevels;
</ins><span class="cx">
</span><del>- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Texture2D.MipLevels = (mMipLevels == 0 ? -1 : mMipLevels);
- srvDesc.Texture2D.MostDetailedMip = 0;
</del><ins>+ ID3D11ShaderResourceView *SRV = NULL;
</ins><span class="cx">
</span><del>- HRESULT result = device->CreateShaderResourceView(mTexture, &srvDesc, &mSRV);
</del><ins>+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
</ins><span class="cx">
</span><del>- if (result == E_OUTOFMEMORY)
- {
- return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11ShaderResourceView*>(NULL));
- }
- ASSERT(SUCCEEDED(result));
</del><ins>+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
</ins><span class="cx"> }
</span><ins>+ ASSERT(SUCCEEDED(result));
</ins><span class="cx">
</span><del>- return mSRV;
</del><ins>+ return SRV;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TextureStorage11_2D::generateMipmap(int level)
</span><span class="cx"> {
</span><ins>+ invalidateSwizzleCacheLevel(level);
+
</ins><span class="cx"> RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTarget(level - 1));
</span><span class="cx"> RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTarget(level));
</span><span class="cx">
</span><span class="cx"> generateMipmapLayer(source, dest);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
- : TextureStorage11(renderer, GetTextureBindFlags(gl_d3d11::ConvertTextureFormat(internalformat), usage, forceRenderable))
</del><ins>+ID3D11Resource *TextureStorage11_2D::getSwizzleTexture()
</ins><span class="cx"> {
</span><del>- for (unsigned int i = 0; i < 6; i++)
</del><ins>+ if (!mSwizzleTexture)
</ins><span class="cx"> {
</span><del>- for (unsigned int j = 0; j < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; j++)
</del><ins>+ ID3D11Device *device = mRenderer->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->CreateTexture2D(&desc, NULL, &mSwizzleTexture);
+
+ if (result == E_OUTOFMEMORY)
</ins><span class="cx"> {
</span><del>- mRenderTarget[i][j] = NULL;
</del><ins>+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture2D*>(NULL));
</ins><span class="cx"> }
</span><ins>+ ASSERT(SUCCEEDED(result));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- DXGI_FORMAT convertedFormat = gl_d3d11::ConvertTextureFormat(internalformat);
- if (d3d11::IsDepthStencilFormat(convertedFormat))
</del><ins>+ return mSwizzleTexture;
+}
+
+ID3D11RenderTargetView *TextureStorage11_2D::getSwizzleRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
</ins><span class="cx"> {
</span><del>- mTextureFormat = d3d11::GetDepthTextureFormat(convertedFormat);
- mShaderResourceFormat = d3d11::GetDepthShaderResourceFormat(convertedFormat);
- mDepthStencilFormat = convertedFormat;
- mRenderTargetFormat = DXGI_FORMAT_UNKNOWN;
</del><ins>+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mSwizzleRenderTargetFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
+
+ HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- mTextureFormat = convertedFormat;
- mShaderResourceFormat = convertedFormat;
- mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
- mRenderTargetFormat = convertedFormat;
</del><ins>+ return NULL;
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><ins>+unsigned int TextureStorage11_2D::getTextureLevelDepth(int mipLevel) const
+{
+ return 1;
+}
+
+TextureStorage11_Cube::TextureStorage11_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
+{
+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ mSwizzleRenderTargets[level] = NULL;
+ for (unsigned int face = 0; face < 6; face++)
+ {
+ mRenderTarget[face][level] = NULL;
+ }
+ }
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
</ins><span class="cx"> // if the size is not positive this should be treated as an incomplete texture
</span><span class="cx"> // we handle that here by skipping the d3d texture creation
</span><span class="cx"> if (size > 0)
</span><span class="cx"> {
</span><span class="cx"> // adjust size if needed for compressed textures
</span><span class="cx"> int height = size;
</span><del>- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &size, &height, &mLodOffset);
</del><ins>+ d3d11::MakeValidSize(false, mTextureFormat, &size, &height, &mTopLevel);
</ins><span class="cx">
</span><span class="cx"> ID3D11Device *device = mRenderer->getDevice();
</span><span class="cx">
</span><span class="cx"> D3D11_TEXTURE2D_DESC desc;
</span><span class="cx"> desc.Width = size;
</span><span class="cx"> desc.Height = size;
</span><del>- desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0;
</del><ins>+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
</ins><span class="cx"> desc.ArraySize = 6;
</span><span class="cx"> desc.Format = mTextureFormat;
</span><span class="cx"> desc.SampleDesc.Count = 1;
</span><span class="lines">@@ -503,30 +740,22 @@
</span><span class="cx"> mMipLevels = desc.MipLevels;
</span><span class="cx"> mTextureWidth = desc.Width;
</span><span class="cx"> mTextureHeight = desc.Height;
</span><ins>+ mTextureDepth = 1;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorage11_Cube::~TextureStorage11_Cube()
</span><span class="cx"> {
</span><del>- if (mTexture)
- {
- mTexture->Release();
- mTexture = NULL;
- }
</del><ins>+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
</ins><span class="cx">
</span><del>- if (mSRV)
</del><ins>+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
</ins><span class="cx"> {
</span><del>- mSRV->Release();
- mSRV = NULL;
- }
-
- for (unsigned int i = 0; i < 6; i++)
- {
- for (unsigned int j = 0; j < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; j++)
</del><ins>+ SafeRelease(mSwizzleRenderTargets[level]);
+ for (unsigned int face = 0; face < 6; face++)
</ins><span class="cx"> {
</span><del>- delete mRenderTarget[i][j];
- mRenderTarget[i][j] = NULL;
</del><ins>+ SafeDelete(mRenderTarget[face][level]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -537,12 +766,17 @@
</span><span class="cx"> return static_cast<TextureStorage11_Cube*>(storage);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget *TextureStorage11_Cube::getRenderTarget(GLenum faceTarget, int level)
</del><ins>+ID3D11Resource *TextureStorage11_Cube::getResource() const
</ins><span class="cx"> {
</span><del>- unsigned int faceIdx = gl::TextureCubeMap::faceIndex(faceTarget);
- if (level >= 0 && level < static_cast<int>(mMipLevels))
</del><ins>+ return mTexture;
+}
+
+RenderTarget *TextureStorage11_Cube::getRenderTargetFace(GLenum faceTarget, int level)
+{
+ if (level >= 0 && level < getLevelCount())
</ins><span class="cx"> {
</span><del>- if (!mRenderTarget[faceIdx][level])
</del><ins>+ int faceIndex = gl::TextureCubeMap::targetToIndex(faceTarget);
+ if (!mRenderTarget[faceIndex][level])
</ins><span class="cx"> {
</span><span class="cx"> ID3D11Device *device = mRenderer->getDevice();
</span><span class="cx"> HRESULT result;
</span><span class="lines">@@ -550,9 +784,9 @@
</span><span class="cx"> D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
</span><span class="cx"> srvDesc.Format = mShaderResourceFormat;
</span><span class="cx"> srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; // Will be used with Texture2D sampler, not TextureCube
</span><del>- srvDesc.Texture2DArray.MostDetailedMip = level;
</del><ins>+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + level;
</ins><span class="cx"> srvDesc.Texture2DArray.MipLevels = 1;
</span><del>- srvDesc.Texture2DArray.FirstArraySlice = faceIdx;
</del><ins>+ srvDesc.Texture2DArray.FirstArraySlice = faceIndex;
</ins><span class="cx"> srvDesc.Texture2DArray.ArraySize = 1;
</span><span class="cx">
</span><span class="cx"> ID3D11ShaderResourceView *srv;
</span><span class="lines">@@ -569,8 +803,8 @@
</span><span class="cx"> D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
</span><span class="cx"> rtvDesc.Format = mRenderTargetFormat;
</span><span class="cx"> rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
</span><del>- rtvDesc.Texture2DArray.MipSlice = level;
- rtvDesc.Texture2DArray.FirstArraySlice = faceIdx;
</del><ins>+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ rtvDesc.Texture2DArray.FirstArraySlice = faceIndex;
</ins><span class="cx"> rtvDesc.Texture2DArray.ArraySize = 1;
</span><span class="cx">
</span><span class="cx"> ID3D11RenderTargetView *rtv;
</span><span class="lines">@@ -578,26 +812,25 @@
</span><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><del>- srv->Release();
</del><ins>+ SafeRelease(srv);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
</span><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
</del><ins>+ mRenderTarget[faceIndex][level] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
</ins><span class="cx">
</span><del>- mRenderTarget[faceIdx][level] = new RenderTarget11(mRenderer, rtv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
</del><ins>+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ SafeRelease(srv);
</ins><span class="cx"> }
</span><span class="cx"> else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
</span><span class="cx"> {
</span><span class="cx"> D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
</span><del>- dsvDesc.Format = mRenderTargetFormat;
</del><ins>+ dsvDesc.Format = mDepthStencilFormat;
</ins><span class="cx"> dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
</span><del>- dsvDesc.Texture2DArray.MipSlice = level;
- dsvDesc.Texture2DArray.FirstArraySlice = faceIdx;
</del><ins>+ dsvDesc.Flags = 0;
+ dsvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ dsvDesc.Texture2DArray.FirstArraySlice = faceIndex;
</ins><span class="cx"> dsvDesc.Texture2DArray.ArraySize = 1;
</span><span class="cx">
</span><span class="cx"> ID3D11DepthStencilView *dsv;
</span><span class="lines">@@ -605,18 +838,16 @@
</span><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><del>- srv->Release();
</del><ins>+ SafeRelease(srv);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
</span><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- // RenderTarget11 expects to be the owner of the resources it is given but TextureStorage11
- // also needs to keep a reference to the texture.
- mTexture->AddRef();
</del><ins>+ mRenderTarget[faceIndex][level] = new RenderTarget11(mRenderer, dsv, mTexture, srv, getLevelWidth(level), getLevelHeight(level), 1);
</ins><span class="cx">
</span><del>- mRenderTarget[faceIdx][level] = new RenderTarget11(mRenderer, dsv, mTexture, srv,
- std::max(mTextureWidth >> level, 1U),
- std::max(mTextureHeight >> level, 1U));
</del><ins>+ // RenderTarget will take ownership of these resources
+ SafeRelease(dsv);
+ SafeRelease(srv);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -624,7 +855,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return mRenderTarget[faceIdx][level];
</del><ins>+ return mRenderTarget[faceIndex][level];
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -632,36 +863,705 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ID3D11ShaderResourceView *TextureStorage11_Cube::getSRV()
</del><ins>+ID3D11ShaderResourceView *TextureStorage11_Cube::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
</ins><span class="cx"> {
</span><del>- if (!mSRV)
</del><ins>+ 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
+ bool unnormalizedInteger = (d3d11::GetComponentType(mTextureFormat) == GL_INT ||
+ d3d11::GetComponentType(mTextureFormat) == GL_UNSIGNED_INT);
+
+ if(unnormalizedInteger)
</ins><span class="cx"> {
</span><ins>+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = 6;
+ }
+ else
+ {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+ srvDesc.TextureCube.MipLevels = mipLevels;
+ srvDesc.TextureCube.MostDetailedMip = mTopLevel + baseLevel;
+ }
+
+ ID3D11ShaderResourceView *SRV = NULL;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ ASSERT(SUCCEEDED(result));
+
+ return SRV;
+}
+
+void TextureStorage11_Cube::generateMipmap(int faceIndex, int level)
+{
+ invalidateSwizzleCacheLevel(level);
+
+ RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTargetFace(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level - 1));
+ RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTargetFace(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level));
+
+ generateMipmapLayer(source, dest);
+}
+
+ID3D11Resource *TextureStorage11_Cube::getSwizzleTexture()
+{
+ if (!mSwizzleTexture)
+ {
</ins><span class="cx"> ID3D11Device *device = mRenderer->getDevice();
</span><span class="cx">
</span><del>- D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = mShaderResourceFormat;
- srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
- srvDesc.TextureCube.MipLevels = (mMipLevels == 0 ? -1 : mMipLevels);
- srvDesc.TextureCube.MostDetailedMip = 0;
</del><ins>+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = 6;
+ 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;
</ins><span class="cx">
</span><del>- HRESULT result = device->CreateShaderResourceView(mTexture, &srvDesc, &mSRV);
</del><ins>+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mSwizzleTexture);
</ins><span class="cx">
</span><span class="cx"> if (result == E_OUTOFMEMORY)
</span><span class="cx"> {
</span><del>- return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11ShaderResourceView*>(NULL));
</del><ins>+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture2D*>(NULL));
</ins><span class="cx"> }
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return mSRV;
</del><ins>+ return mSwizzleTexture;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureStorage11_Cube::generateMipmap(int face, int level)
</del><ins>+ID3D11RenderTargetView *TextureStorage11_Cube::getSwizzleRenderTarget(int mipLevel)
</ins><span class="cx"> {
</span><del>- RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTarget(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level - 1));
- RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTarget(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level));
</del><ins>+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
</ins><span class="cx">
</span><ins>+ ID3D11Device *device = mRenderer->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 = 6;
+
+ HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+unsigned int TextureStorage11_Cube::getTextureLevelDepth(int mipLevel) const
+{
+ return 6;
+}
+
+TextureStorage11_3D::TextureStorage11_3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
+{
+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mLevelRenderTargets[i] = NULL;
+ mSwizzleRenderTargets[i] = NULL;
+ }
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
+ // 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 (width > 0 && height > 0 && depth > 0)
+ {
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, mTextureFormat, &width, &height, &mTopLevel);
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE3D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.Depth = depth;
+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
+ desc.Format = mTextureFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture3D(&desc, NULL, &mTexture);
+
+ // this can happen from windows TDR
+ if (d3d11::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else
+ {
+ mTexture->GetDesc(&desc);
+ mMipLevels = desc.MipLevels;
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = desc.Depth;
+ }
+ }
+}
+
+TextureStorage11_3D::~TextureStorage11_3D()
+{
+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
+
+ for (RenderTargetMap::iterator i = mLevelLayerRenderTargets.begin(); i != mLevelLayerRenderTargets.end(); i++)
+ {
+ SafeDelete(i->second);
+ }
+ mLevelLayerRenderTargets.clear();
+
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ SafeDelete(mLevelRenderTargets[i]);
+ SafeRelease(mSwizzleRenderTargets[i]);
+ }
+}
+
+TextureStorage11_3D *TextureStorage11_3D::makeTextureStorage11_3D(TextureStorage *storage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_3D*, storage));
+ return static_cast<TextureStorage11_3D*>(storage);
+}
+
+ID3D11Resource *TextureStorage11_3D::getResource() const
+{
+ return mTexture;
+}
+
+ID3D11ShaderResourceView *TextureStorage11_3D::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
+ srvDesc.Texture3D.MostDetailedMip = baseLevel;
+ srvDesc.Texture3D.MipLevels = mipLevels;
+
+ ID3D11ShaderResourceView *SRV = NULL;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ ASSERT(SUCCEEDED(result));
+
+ return SRV;
+}
+
+RenderTarget *TextureStorage11_3D::getRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mLevelRenderTargets[mipLevel])
+ {
+ ID3D11ShaderResourceView *srv = getSRVLevel(mipLevel);
+ if (!srv)
+ {
+ return NULL;
+ }
+
+ if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ ID3D11Device *device = mRenderer->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 = -1;
+
+ ID3D11RenderTargetView *rtv;
+ HRESULT result = device->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mLevelRenderTargets[mipLevel] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(mipLevel), getLevelHeight(mipLevel), getLevelDepth(mipLevel));
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mLevelRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+RenderTarget *TextureStorage11_3D::getRenderTargetLayer(int mipLevel, int layer)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ LevelLayerKey key(mipLevel, layer);
+ if (mLevelLayerRenderTargets.find(key) == mLevelLayerRenderTargets.end())
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result;
+
+ // TODO, what kind of SRV is expected here?
+ ID3D11ShaderResourceView *srv = NULL;
+
+ if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ 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->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mLevelLayerRenderTargets[key] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ SafeRelease(srv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mLevelLayerRenderTargets[key];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+void TextureStorage11_3D::generateMipmap(int level)
+{
+ invalidateSwizzleCacheLevel(level);
+
+ RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTarget(level - 1));
+ RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTarget(level));
+
</ins><span class="cx"> generateMipmapLayer(source, dest);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ID3D11Resource *TextureStorage11_3D::getSwizzleTexture()
+{
+ if (!mSwizzleTexture)
+ {
+ ID3D11Device *device = mRenderer->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->CreateTexture3D(&desc, NULL, &mSwizzleTexture);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture3D*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleTexture;
</ins><span class="cx"> }
</span><ins>+
+ID3D11RenderTargetView *TextureStorage11_3D::getSwizzleRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
+
+ ID3D11Device *device = mRenderer->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 = -1;
+
+ HRESULT result = device->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+unsigned int TextureStorage11_3D::getTextureLevelDepth(int mipLevel) const
+{
+ return std::max(mTextureDepth >> mipLevel, 1U);
+}
+
+
+TextureStorage11_2DArray::TextureStorage11_2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels)
+ : TextureStorage11(renderer, GetTextureBindFlags(internalformat, renderer->getCurrentClientVersion(), renderTarget))
+{
+ mTexture = NULL;
+ mSwizzleTexture = NULL;
+
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ mSwizzleRenderTargets[level] = NULL;
+ }
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
+ mTextureFormat = gl_d3d11::GetTexFormat(internalformat, clientVersion);
+ mShaderResourceFormat = gl_d3d11::GetSRVFormat(internalformat, clientVersion);
+ mDepthStencilFormat = gl_d3d11::GetDSVFormat(internalformat, clientVersion);
+ mRenderTargetFormat = gl_d3d11::GetRTVFormat(internalformat, clientVersion);
+ mSwizzleTextureFormat = gl_d3d11::GetSwizzleTexFormat(internalformat, renderer);
+ mSwizzleShaderResourceFormat = gl_d3d11::GetSwizzleSRVFormat(internalformat, renderer);
+ mSwizzleRenderTargetFormat = gl_d3d11::GetSwizzleRTVFormat(internalformat, renderer);
+
+ // 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 (width > 0 && height > 0 && depth > 0)
+ {
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, mTextureFormat, &width, &height, &mTopLevel);
+
+ ID3D11Device *device = mRenderer->getDevice();
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = ((levels > 0) ? (mTopLevel + levels) : 0);
+ desc.ArraySize = depth;
+ desc.Format = mTextureFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ HRESULT result = device->CreateTexture2D(&desc, NULL, &mTexture);
+
+ // this can happen from windows TDR
+ if (d3d11::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else if (FAILED(result))
+ {
+ ASSERT(result == E_OUTOFMEMORY);
+ ERR("Creating image failed.");
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ else
+ {
+ mTexture->GetDesc(&desc);
+ mMipLevels = desc.MipLevels;
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = desc.ArraySize;
+ }
+ }
+}
+
+TextureStorage11_2DArray::~TextureStorage11_2DArray()
+{
+ SafeRelease(mTexture);
+ SafeRelease(mSwizzleTexture);
+
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ SafeRelease(mSwizzleRenderTargets[level]);
+ }
+
+ for (RenderTargetMap::iterator i = mRenderTargets.begin(); i != mRenderTargets.end(); i++)
+ {
+ SafeDelete(i->second);
+ }
+ mRenderTargets.clear();
+}
+
+TextureStorage11_2DArray *TextureStorage11_2DArray::makeTextureStorage11_2DArray(TextureStorage *storage)
+{
+ ASSERT(HAS_DYNAMIC_TYPE(TextureStorage11_2DArray*, storage));
+ return static_cast<TextureStorage11_2DArray*>(storage);
+}
+
+ID3D11Resource *TextureStorage11_2DArray::getResource() const
+{
+ return mTexture;
+}
+
+ID3D11ShaderResourceView *TextureStorage11_2DArray::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture)
+{
+ 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;
+
+ ID3D11ShaderResourceView *SRV = NULL;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result = device->CreateShaderResourceView(texture, &srvDesc, &SRV);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ gl::error(GL_OUT_OF_MEMORY);
+ }
+ ASSERT(SUCCEEDED(result));
+
+ return SRV;
+}
+
+RenderTarget *TextureStorage11_2DArray::getRenderTargetLayer(int mipLevel, int layer)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ LevelLayerKey key(mipLevel, layer);
+ if (mRenderTargets.find(key) == mRenderTargets.end())
+ {
+ ID3D11Device *device = mRenderer->getDevice();
+ HRESULT result;
+
+ 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->CreateShaderResourceView(mTexture, &srvDesc, &srv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(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->CreateRenderTargetView(mTexture, &rtvDesc, &rtv);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ SafeRelease(srv);
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<RenderTarget*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+
+ mRenderTargets[key] = new RenderTarget11(mRenderer, rtv, mTexture, srv, getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1);
+
+ // RenderTarget will take ownership of these resources
+ SafeRelease(rtv);
+ SafeRelease(srv);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ return mRenderTargets[key];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+void TextureStorage11_2DArray::generateMipmap(int level)
+{
+ invalidateSwizzleCacheLevel(level);
+ for (unsigned int layer = 0; layer < mTextureDepth; layer++)
+ {
+ RenderTarget11 *source = RenderTarget11::makeRenderTarget11(getRenderTargetLayer(level - 1, layer));
+ RenderTarget11 *dest = RenderTarget11::makeRenderTarget11(getRenderTargetLayer(level, layer));
+
+ generateMipmapLayer(source, dest);
+ }
+}
+
+ID3D11Resource *TextureStorage11_2DArray::getSwizzleTexture()
+{
+ if (!mSwizzleTexture)
+ {
+ ID3D11Device *device = mRenderer->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->CreateTexture2D(&desc, NULL, &mSwizzleTexture);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11Texture2D*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleTexture;
+}
+
+ID3D11RenderTargetView *TextureStorage11_2DArray::getSwizzleRenderTarget(int mipLevel)
+{
+ if (mipLevel >= 0 && mipLevel < getLevelCount())
+ {
+ if (!mSwizzleRenderTargets[mipLevel])
+ {
+ ID3D11Resource *swizzleTexture = getSwizzleTexture();
+ if (!swizzleTexture)
+ {
+ return NULL;
+ }
+
+ ID3D11Device *device = mRenderer->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->CreateRenderTargetView(mSwizzleTexture, &rtvDesc, &mSwizzleRenderTargets[mipLevel]);
+
+ if (result == E_OUTOFMEMORY)
+ {
+ return gl::error(GL_OUT_OF_MEMORY, static_cast<ID3D11RenderTargetView*>(NULL));
+ }
+ ASSERT(SUCCEEDED(result));
+ }
+
+ return mSwizzleRenderTargets[mipLevel];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+unsigned int TextureStorage11_2DArray::getTextureLevelDepth(int mipLevel) const
+{
+ return mTextureDepth;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11TextureStorage11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/TextureStorage11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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">@@ -24,97 +24,255 @@
</span><span class="cx"> class TextureStorage11 : public TextureStorage
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- TextureStorage11(Renderer *renderer, UINT bindFlags);
</del><span class="cx"> virtual ~TextureStorage11();
</span><span class="cx">
</span><span class="cx"> static TextureStorage11 *makeTextureStorage11(TextureStorage *storage);
</span><span class="cx">
</span><del>- static DWORD GetTextureBindFlags(DXGI_FORMAT d3dfmt, GLenum glusage, bool forceRenderable);
- static bool IsTextureFormatRenderable(DXGI_FORMAT format);
</del><ins>+ static DWORD GetTextureBindFlags(GLenum internalFormat, GLuint clientVersion, bool renderTarget);
</ins><span class="cx">
</span><span class="cx"> UINT getBindFlags() const;
</span><span class="cx">
</span><del>- virtual ID3D11Texture2D *getBaseTexture() const;
- virtual ID3D11ShaderResourceView *getSRV() = 0;
- virtual RenderTarget *getRenderTarget() { return getRenderTarget(0); }
</del><ins>+ virtual ID3D11Resource *getResource() const = 0;
+ virtual ID3D11ShaderResourceView *getSRV(const gl::SamplerState &samplerState);
</ins><span class="cx"> virtual RenderTarget *getRenderTarget(int level) { return NULL; }
</span><del>- virtual RenderTarget *getRenderTarget(GLenum faceTarget) { return getRenderTarget(faceTarget, 0); }
- virtual RenderTarget *getRenderTarget(GLenum faceTarget, int level) { return NULL; }
</del><ins>+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level) { return NULL; }
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer) { return NULL; }
</ins><span class="cx">
</span><span class="cx"> virtual void generateMipmap(int level) {};
</span><span class="cx"> virtual void generateMipmap(int face, int level) {};
</span><span class="cx">
</span><del>- virtual int getLodOffset() const;
</del><ins>+ virtual int getTopLevel() const;
</ins><span class="cx"> virtual bool isRenderTarget() const;
</span><span class="cx"> virtual bool isManaged() const;
</span><del>- virtual int levelCount();
- UINT getSubresourceIndex(int level, int faceTarget);
</del><ins>+ virtual int getLevelCount() const;
+ UINT getSubresourceIndex(int mipLevel, int layerTarget) const;
</ins><span class="cx">
</span><del>- bool updateSubresourceLevel(ID3D11Texture2D *texture, unsigned int sourceSubresource, int level,
- int faceTarget, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
</del><ins>+ void generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+ void invalidateSwizzleCacheLevel(int mipLevel);
+ void invalidateSwizzleCache();
</ins><span class="cx">
</span><ins>+ bool updateSubresourceLevel(ID3D11Resource *texture, unsigned int sourceSubresource, int level,
+ int layerTarget, GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth);
+
</ins><span class="cx"> protected:
</span><ins>+ TextureStorage11(Renderer *renderer, UINT bindFlags);
</ins><span class="cx"> void generateMipmapLayer(RenderTarget11 *source, RenderTarget11 *dest);
</span><ins>+ int getLevelWidth(int mipLevel) const;
+ int getLevelHeight(int mipLevel) const;
+ int getLevelDepth(int mipLevel) const;
</ins><span class="cx">
</span><ins>+ virtual ID3D11Resource *getSwizzleTexture() = 0;
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel) = 0;
+ ID3D11ShaderResourceView *getSRVLevel(int mipLevel);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture) = 0;
+
+ void verifySwizzleExists(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const = 0;
+
</ins><span class="cx"> Renderer11 *mRenderer;
</span><del>- int mLodOffset;
</del><ins>+ int mTopLevel;
</ins><span class="cx"> unsigned int mMipLevels;
</span><span class="cx">
</span><del>- ID3D11Texture2D *mTexture;
</del><span class="cx"> DXGI_FORMAT mTextureFormat;
</span><span class="cx"> DXGI_FORMAT mShaderResourceFormat;
</span><span class="cx"> DXGI_FORMAT mRenderTargetFormat;
</span><span class="cx"> DXGI_FORMAT mDepthStencilFormat;
</span><ins>+ DXGI_FORMAT mSwizzleTextureFormat;
+ DXGI_FORMAT mSwizzleShaderResourceFormat;
+ DXGI_FORMAT mSwizzleRenderTargetFormat;
</ins><span class="cx"> unsigned int mTextureWidth;
</span><span class="cx"> unsigned int mTextureHeight;
</span><ins>+ unsigned int mTextureDepth;
</ins><span class="cx">
</span><del>- ID3D11ShaderResourceView *mSRV;
</del><ins>+ struct SwizzleCacheValue
+ {
+ GLenum swizzleRed;
+ GLenum swizzleGreen;
+ GLenum swizzleBlue;
+ GLenum swizzleAlpha;
</ins><span class="cx">
</span><ins>+ SwizzleCacheValue();
+ SwizzleCacheValue(GLenum red, GLenum green, GLenum blue, GLenum alpha);
+
+ bool operator ==(const SwizzleCacheValue &other) const;
+ bool operator !=(const SwizzleCacheValue &other) const;
+ };
+ SwizzleCacheValue mSwizzleCache[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ struct SRVKey
+ {
+ SRVKey(int baseLevel = 0, int mipLevels = 0, bool swizzle = false);
+
+ bool operator==(const SRVKey &rhs) const;
+
+ int baseLevel;
+ int mipLevels;
+ bool swizzle;
+ };
+
+ struct SRVPair
+ {
+ SRVKey key;
+ ID3D11ShaderResourceView *srv;
+ };
+
+ struct SRVCache
+ {
+ ~SRVCache();
+
+ ID3D11ShaderResourceView *find(const SRVKey &key) const;
+ ID3D11ShaderResourceView *add(const SRVKey &key, ID3D11ShaderResourceView *srv);
+
+ std::vector<SRVPair> cache;
+ };
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureStorage11);
</span><span class="cx">
</span><span class="cx"> const UINT mBindFlags;
</span><ins>+
+ SRVCache srvCache;
+ ID3D11ShaderResourceView *mLevelSRVs[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class TextureStorage11_2D : public TextureStorage11
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx"> TextureStorage11_2D(Renderer *renderer, SwapChain11 *swapchain);
</span><del>- TextureStorage11_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
</del><ins>+ TextureStorage11_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
</ins><span class="cx"> virtual ~TextureStorage11_2D();
</span><span class="cx">
</span><span class="cx"> static TextureStorage11_2D *makeTextureStorage11_2D(TextureStorage *storage);
</span><span class="cx">
</span><del>- virtual ID3D11ShaderResourceView *getSRV();
</del><ins>+ virtual ID3D11Resource *getResource() const;
</ins><span class="cx"> virtual RenderTarget *getRenderTarget(int level);
</span><span class="cx">
</span><span class="cx"> virtual void generateMipmap(int level);
</span><span class="cx">
</span><ins>+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureStorage11_2D);
</span><span class="cx">
</span><ins>+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ ID3D11Texture2D *mTexture;
</ins><span class="cx"> RenderTarget11 *mRenderTarget[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
</span><ins>+
+ ID3D11Texture2D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class TextureStorage11_Cube : public TextureStorage11
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- TextureStorage11_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
</del><ins>+ TextureStorage11_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels);
</ins><span class="cx"> virtual ~TextureStorage11_Cube();
</span><span class="cx">
</span><span class="cx"> static TextureStorage11_Cube *makeTextureStorage11_Cube(TextureStorage *storage);
</span><span class="cx">
</span><del>- virtual ID3D11ShaderResourceView *getSRV();
- virtual RenderTarget *getRenderTarget(GLenum faceTarget, int level);
</del><ins>+ virtual ID3D11Resource *getResource() const;
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level);
</ins><span class="cx">
</span><del>- virtual void generateMipmap(int face, int level);
</del><ins>+ virtual void generateMipmap(int faceIndex, int level);
</ins><span class="cx">
</span><ins>+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureStorage11_Cube);
</span><span class="cx">
</span><ins>+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ ID3D11Texture2D *mTexture;
</ins><span class="cx"> RenderTarget11 *mRenderTarget[6][gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
</span><ins>+
+ ID3D11Texture2D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+class TextureStorage11_3D : public TextureStorage11
+{
+ public:
+ TextureStorage11_3D(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorage11_3D();
+
+ static TextureStorage11_3D *makeTextureStorage11_3D(TextureStorage *storage);
+
+ virtual ID3D11Resource *getResource() const;
+ virtual RenderTarget *getRenderTarget(int mipLevel);
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer);
+
+ virtual void generateMipmap(int level);
+
+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorage11_3D);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ typedef std::pair<int, int> LevelLayerKey;
+ typedef std::map<LevelLayerKey, RenderTarget11*> RenderTargetMap;
+ RenderTargetMap mLevelLayerRenderTargets;
+
+ RenderTarget11 *mLevelRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+ ID3D11Texture3D *mTexture;
+ ID3D11Texture3D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_2DArray : public TextureStorage11
+{
+ public:
+ TextureStorage11_2DArray(Renderer *renderer, GLenum internalformat, bool renderTarget,
+ GLsizei width, GLsizei height, GLsizei depth, int levels);
+ virtual ~TextureStorage11_2DArray();
+
+ static TextureStorage11_2DArray *makeTextureStorage11_2DArray(TextureStorage *storage);
+
+ virtual ID3D11Resource *getResource() const;
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer);
+
+ virtual void generateMipmap(int level);
+
+ protected:
+ virtual ID3D11Resource *getSwizzleTexture();
+ virtual ID3D11RenderTargetView *getSwizzleRenderTarget(int mipLevel);
+
+ virtual unsigned int getTextureLevelDepth(int mipLevel) const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TextureStorage11_2DArray);
+
+ virtual ID3D11ShaderResourceView *createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture);
+
+ typedef std::pair<int, int> LevelLayerKey;
+ typedef std::map<LevelLayerKey, RenderTarget11*> RenderTargetMap;
+ RenderTargetMap mRenderTargets;
+
+ ID3D11Texture2D *mTexture;
+
+ ID3D11Texture2D *mSwizzleTexture;
+ ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // LIBGLESV2_RENDERER_TEXTURESTORAGE11_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11VertexBuffer11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,7 +12,8 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/Renderer11.h"
</span><del>-#include "libGLESv2/Context.h"
</del><ins>+#include "libGLESv2/VertexAttribute.h"
+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -26,20 +27,12 @@
</span><span class="cx">
</span><span class="cx"> VertexBuffer11::~VertexBuffer11()
</span><span class="cx"> {
</span><del>- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
</del><ins>+ SafeRelease(mBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
</span><span class="cx"> {
</span><del>- if (mBuffer)
- {
- mBuffer->Release();
- mBuffer = NULL;
- }
</del><ins>+ SafeRelease(mBuffer);
</ins><span class="cx">
</span><span class="cx"> updateSerial();
</span><span class="cx">
</span><span class="lines">@@ -73,16 +66,13 @@
</span><span class="cx"> return static_cast<VertexBuffer11*>(vetexBuffer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count,
- GLsizei instances, unsigned int offset)
</del><ins>+bool VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset)
</ins><span class="cx"> {
</span><span class="cx"> if (mBuffer)
</span><span class="cx"> {
</span><span class="cx"> gl::Buffer *buffer = attrib.mBoundBuffer.get();
</span><del>-
</del><span class="cx"> int inputStride = attrib.stride();
</span><del>- const VertexConverter &converter = getVertexConversion(attrib);
-
</del><span class="cx"> ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
</span><span class="cx">
</span><span class="cx"> D3D11_MAPPED_SUBRESOURCE mappedResource;
</span><span class="lines">@@ -96,14 +86,21 @@
</span><span class="cx"> char* output = reinterpret_cast<char*>(mappedResource.pData) + offset;
</span><span class="cx">
</span><span class="cx"> const char *input = NULL;
</span><del>- if (buffer)
</del><ins>+ if (attrib.mArrayEnabled)
</ins><span class="cx"> {
</span><del>- BufferStorage *storage = buffer->getStorage();
- input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
</del><ins>+ if (buffer)
+ {
+ BufferStorage *storage = buffer->getStorage();
+ input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
+ }
+ else
+ {
+ input = static_cast<const char*>(attrib.mPointer);
+ }
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- input = static_cast<const char*>(attrib.mPointer);
</del><ins>+ input = reinterpret_cast<const char*>(currentValue.FloatValues);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (instances == 0 || attrib.mDivisor == 0)
</span><span class="lines">@@ -111,7 +108,10 @@
</span><span class="cx"> input += inputStride * start;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- converter.conversionFunc(input, inputStride, count, output);
</del><ins>+ gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+ VertexCopyFunction conversionFunc = gl_d3d11::GetVertexCopyFunction(vertexFormat);
+ ASSERT(conversionFunc != NULL);
+ conversionFunc(input, inputStride, count, output);
</ins><span class="cx">
</span><span class="cx"> dxContext->Unmap(mBuffer, 0);
</span><span class="cx">
</span><span class="lines">@@ -124,76 +124,55 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool VertexBuffer11::storeRawData(const void* data, unsigned int size, unsigned int offset)
-{
- if (mBuffer)
- {
- ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
-
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
- if (FAILED(result))
- {
- ERR("Vertex buffer map failed with error 0x%08x", result);
- return false;
- }
-
- char* bufferData = static_cast<char*>(mappedResource.pData);
- memcpy(bufferData + offset, data, size);
-
- dxContext->Unmap(mBuffer, 0);
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
</del><span class="cx"> bool VertexBuffer11::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count,
</span><span class="cx"> GLsizei instances, unsigned int *outSpaceRequired) const
</span><span class="cx"> {
</span><del>- unsigned int elementSize = getVertexConversion(attrib).outputElementSize;
-
</del><span class="cx"> unsigned int elementCount = 0;
</span><del>- if (instances == 0 || attrib.mDivisor == 0)
</del><ins>+ if (attrib.mArrayEnabled)
</ins><span class="cx"> {
</span><del>- elementCount = count;
- }
- else
- {
- if (static_cast<unsigned int>(instances) < std::numeric_limits<unsigned int>::max() - (attrib.mDivisor - 1))
</del><ins>+ if (instances == 0 || attrib.mDivisor == 0)
</ins><span class="cx"> {
</span><del>- // Round up
- elementCount = (static_cast<unsigned int>(instances) + (attrib.mDivisor - 1)) / attrib.mDivisor;
</del><ins>+ elementCount = count;
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- elementCount = instances / attrib.mDivisor;
</del><ins>+ if (static_cast<unsigned int>(instances) < std::numeric_limits<unsigned int>::max() - (attrib.mDivisor - 1))
+ {
+ // Round up
+ elementCount = rx::roundUp(static_cast<unsigned int>(instances), attrib.mDivisor);
+ }
+ else
+ {
+ elementCount = instances / attrib.mDivisor;
+ }
</ins><span class="cx"> }
</span><del>- }
</del><span class="cx">
</span><del>- if (elementSize <= std::numeric_limits<unsigned int>::max() / elementCount)
</del><ins>+ gl::VertexFormat vertexFormat(attrib);
+ unsigned int elementSize = static_cast<unsigned int>(gl_d3d11::GetVertexElementSize(vertexFormat));
+ if (elementSize <= std::numeric_limits<unsigned int>::max() / elementCount)
+ {
+ if (outSpaceRequired)
+ {
+ *outSpaceRequired = elementSize * elementCount;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
</ins><span class="cx"> {
</span><ins>+ const unsigned int elementSize = 4;
</ins><span class="cx"> if (outSpaceRequired)
</span><span class="cx"> {
</span><del>- *outSpaceRequired = elementSize * elementCount;
</del><ins>+ *outSpaceRequired = elementSize * 4;
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><del>- else
- {
- return false;
- }
</del><span class="cx"> }
</span><span class="cx">
</span><del>-bool VertexBuffer11::requiresConversion(const gl::VertexAttribute &attrib) const
-{
- return !getVertexConversion(attrib).identity;
-}
-
</del><span class="cx"> unsigned int VertexBuffer11::getBufferSize() const
</span><span class="cx"> {
</span><span class="cx"> return mBufferSize;
</span><span class="lines">@@ -236,205 +215,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned int VertexBuffer11::getVertexSize(const gl::VertexAttribute &attrib) const
-{
- return getVertexConversion(attrib).outputElementSize;
-}
-
-DXGI_FORMAT VertexBuffer11::getDXGIFormat(const gl::VertexAttribute &attrib) const
-{
- return getVertexConversion(attrib).dxgiFormat;
-}
-
</del><span class="cx"> ID3D11Buffer *VertexBuffer11::getBuffer() const
</span><span class="cx"> {
</span><span class="cx"> return mBuffer;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template <typename T, unsigned int componentCount, bool widen, bool normalized>
-static void copyVertexData(const void *input, unsigned int stride, unsigned int count, void *output)
-{
- unsigned int attribSize = sizeof(T) * componentCount;
-
- if (attribSize == stride && !widen)
- {
- memcpy(output, input, count * attribSize);
- }
- else
- {
- unsigned int outputStride = widen ? 4 : componentCount;
- T defaultVal = normalized ? std::numeric_limits<T>::max() : T(1);
-
- for (unsigned int i = 0; i < count; i++)
- {
- const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + i * stride);
- T *offsetOutput = reinterpret_cast<T*>(output) + i * outputStride;
-
- for (unsigned int j = 0; j < componentCount; j++)
- {
- offsetOutput[j] = offsetInput[j];
- }
-
- if (widen)
- {
- offsetOutput[3] = defaultVal;
- }
- }
- }
</del><span class="cx"> }
</span><del>-
-template <unsigned int componentCount>
-static void copyFixedVertexData(const void* input, unsigned int stride, unsigned int count, void* output)
-{
- static const float divisor = 1.0f / (1 << 16);
-
- for (unsigned int i = 0; i < count; i++)
- {
- const GLfixed* offsetInput = reinterpret_cast<const GLfixed*>(reinterpret_cast<const char*>(input) + stride * i);
- float* offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
-
- for (unsigned int j = 0; j < componentCount; j++)
- {
- offsetOutput[j] = static_cast<float>(offsetInput[j]) * divisor;
- }
- }
-}
-
-template <typename T, unsigned int componentCount, bool normalized>
-static void copyToFloatVertexData(const void* input, unsigned int stride, unsigned int count, void* output)
-{
- typedef std::numeric_limits<T> NL;
-
- for (unsigned int i = 0; i < count; i++)
- {
- const T *offsetInput = reinterpret_cast<const T*>(reinterpret_cast<const char*>(input) + stride * i);
- float *offsetOutput = reinterpret_cast<float*>(output) + i * componentCount;
-
- for (unsigned int j = 0; j < componentCount; j++)
- {
- if (normalized)
- {
- if (NL::is_signed)
- {
- const float divisor = 1.0f / (2 * static_cast<float>(NL::max()) + 1);
- offsetOutput[j] = (2 * static_cast<float>(offsetInput[j]) + 1) * divisor;
- }
- else
- {
- offsetOutput[j] = static_cast<float>(offsetInput[j]) / NL::max();
- }
- }
- else
- {
- offsetOutput[j] = static_cast<float>(offsetInput[j]);
- }
- }
- }
-}
-
-const VertexBuffer11::VertexConverter VertexBuffer11::mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] =
-{
- { // GL_BYTE
- { // unnormalized
- { &copyToFloatVertexData<GLbyte, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLbyte, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLbyte, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLbyte, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLbyte, 1, false, true>, true, DXGI_FORMAT_R8_SNORM, 1 },
- { &copyVertexData<GLbyte, 2, false, true>, true, DXGI_FORMAT_R8G8_SNORM, 2 },
- { &copyVertexData<GLbyte, 3, true, true>, false, DXGI_FORMAT_R8G8B8A8_SNORM, 4 },
- { &copyVertexData<GLbyte, 4, false, true>, true, DXGI_FORMAT_R8G8B8A8_SNORM, 4 },
- },
- },
- { // GL_UNSIGNED_BYTE
- { // unnormalized
- { &copyToFloatVertexData<GLubyte, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLubyte, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLubyte, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLubyte, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLubyte, 1, false, true>, true, DXGI_FORMAT_R8_UNORM, 1 },
- { &copyVertexData<GLubyte, 2, false, true>, true, DXGI_FORMAT_R8G8_UNORM, 2 },
- { &copyVertexData<GLubyte, 3, true, true>, false, DXGI_FORMAT_R8G8B8A8_UNORM, 4 },
- { &copyVertexData<GLubyte, 4, false, true>, true, DXGI_FORMAT_R8G8B8A8_UNORM, 4 },
- },
- },
- { // GL_SHORT
- { // unnormalized
- { &copyToFloatVertexData<GLshort, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLshort, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLshort, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLshort, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLshort, 1, false, true>, true, DXGI_FORMAT_R16_SNORM, 2 },
- { &copyVertexData<GLshort, 2, false, true>, true, DXGI_FORMAT_R16G16_SNORM, 4 },
- { &copyVertexData<GLshort, 3, true, true>, false, DXGI_FORMAT_R16G16B16A16_SNORM, 8 },
- { &copyVertexData<GLshort, 4, false, true>, true, DXGI_FORMAT_R16G16B16A16_SNORM, 8 },
- },
- },
- { // GL_UNSIGNED_SHORT
- { // unnormalized
- { &copyToFloatVertexData<GLushort, 1, false>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyToFloatVertexData<GLushort, 2, false>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyToFloatVertexData<GLushort, 3, false>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyToFloatVertexData<GLushort, 4, false>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLushort, 1, false, true>, true, DXGI_FORMAT_R16_UNORM, 2 },
- { &copyVertexData<GLushort, 2, false, true>, true, DXGI_FORMAT_R16G16_UNORM, 4 },
- { &copyVertexData<GLushort, 3, true, true>, false, DXGI_FORMAT_R16G16B16A16_UNORM, 8 },
- { &copyVertexData<GLushort, 4, false, true>, true, DXGI_FORMAT_R16G16B16A16_UNORM, 8 },
- },
- },
- { // GL_FIXED
- { // unnormalized
- { &copyFixedVertexData<1>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyFixedVertexData<2>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyFixedVertexData<3>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyFixedVertexData<4>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyFixedVertexData<1>, false, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyFixedVertexData<2>, false, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyFixedVertexData<3>, false, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyFixedVertexData<4>, false, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- },
- { // GL_FLOAT
- { // unnormalized
- { &copyVertexData<GLfloat, 1, false, false>, true, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyVertexData<GLfloat, 2, false, false>, true, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyVertexData<GLfloat, 3, false, false>, true, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyVertexData<GLfloat, 4, false, false>, true, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- { // normalized
- { &copyVertexData<GLfloat, 1, false, false>, true, DXGI_FORMAT_R32_FLOAT, 4 },
- { &copyVertexData<GLfloat, 2, false, false>, true, DXGI_FORMAT_R32G32_FLOAT, 8 },
- { &copyVertexData<GLfloat, 3, false, false>, true, DXGI_FORMAT_R32G32B32_FLOAT, 12 },
- { &copyVertexData<GLfloat, 4, false, false>, true, DXGI_FORMAT_R32G32B32A32_FLOAT, 16 },
- },
- },
-};
-
-const VertexBuffer11::VertexConverter &VertexBuffer11::getVertexConversion(const gl::VertexAttribute &attribute)
-{
- unsigned int typeIndex = 0;
- switch (attribute.mType)
- {
- case GL_BYTE: typeIndex = 0; break;
- case GL_UNSIGNED_BYTE: typeIndex = 1; break;
- case GL_SHORT: typeIndex = 2; break;
- case GL_UNSIGNED_SHORT: typeIndex = 3; break;
- case GL_FIXED: typeIndex = 4; break;
- case GL_FLOAT: typeIndex = 5; break;
- default: UNREACHABLE(); break;
- }
-
- return mPossibleTranslations[typeIndex][attribute.mNormalized ? 1 : 0][attribute.mSize - 1];
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11VertexBuffer11h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/VertexBuffer11.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -25,22 +25,16 @@
</span><span class="cx">
</span><span class="cx"> static VertexBuffer11 *makeVertexBuffer11(VertexBuffer *vetexBuffer);
</span><span class="cx">
</span><del>- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int offset);
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset);
</del><ins>+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset);
</ins><span class="cx">
</span><span class="cx"> virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
</span><span class="cx"> unsigned int *outSpaceRequired) const;
</span><span class="cx">
</span><del>- virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
-
</del><span class="cx"> virtual unsigned int getBufferSize() const;
</span><span class="cx"> virtual bool setBufferSize(unsigned int size);
</span><span class="cx"> virtual bool discard();
</span><span class="cx">
</span><del>- unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
- DXGI_FORMAT getDXGIFormat(const gl::VertexAttribute &attrib) const;
-
</del><span class="cx"> ID3D11Buffer *getBuffer() const;
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -51,22 +45,6 @@
</span><span class="cx"> ID3D11Buffer *mBuffer;
</span><span class="cx"> unsigned int mBufferSize;
</span><span class="cx"> bool mDynamicUsage;
</span><del>-
- typedef void (*VertexConversionFunction)(const void *, unsigned int, unsigned int, void *);
- struct VertexConverter
- {
- VertexConversionFunction conversionFunc;
- bool identity;
- DXGI_FORMAT dxgiFormat;
- unsigned int outputElementSize;
- };
-
- enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
-
- // This table is used to generate mAttributeTypes.
- static const VertexConverter mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
-
- static const VertexConverter &getVertexConversion(const gl::VertexAttribute &attribute);
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11renderer11_utilscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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,9 +9,12 @@
</span><span class="cx"> // specific to the D3D11 renderer.
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d11/renderer11_utils.h"
</span><del>-
</del><ins>+#include "libGLESv2/renderer/d3d11/formatutils11.h"
</ins><span class="cx"> #include "common/debug.h"
</span><span class="cx">
</span><ins>+namespace rx
+{
+
</ins><span class="cx"> namespace gl_d3d11
</span><span class="cx"> {
</span><span class="cx">
</span><span class="lines">@@ -51,6 +54,8 @@
</span><span class="cx"> case GL_FUNC_ADD: d3dBlendOp = D3D11_BLEND_OP_ADD; break;
</span><span class="cx"> case GL_FUNC_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_SUBTRACT; break;
</span><span class="cx"> case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_REV_SUBTRACT; break;
</span><ins>+ case GL_MIN: d3dBlendOp = D3D11_BLEND_OP_MIN; break;
+ case GL_MAX: d3dBlendOp = D3D11_BLEND_OP_MAX; break;
</ins><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -150,11 +155,13 @@
</span><span class="cx"> return d3dStencilOp;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy)
</del><ins>+D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode)
</ins><span class="cx"> {
</span><ins>+ bool comparison = comparisonMode != GL_NONE;
+
</ins><span class="cx"> if (maxAnisotropy > 1.0f)
</span><span class="cx"> {
</span><del>- return D3D11_ENCODE_ANISOTROPIC_FILTER(false);
</del><ins>+ return D3D11_ENCODE_ANISOTROPIC_FILTER(comparison);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -179,7 +186,7 @@
</span><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip, false);
</del><ins>+ return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip, comparison);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -196,202 +203,50 @@
</span><span class="cx"> return D3D11_TEXTURE_ADDRESS_WRAP;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-FLOAT ConvertMinLOD(GLenum minFilter, unsigned int lodOffset)
</del><ins>+D3D11_QUERY ConvertQueryType(GLenum queryType)
</ins><span class="cx"> {
</span><del>- return (minFilter == GL_NEAREST || minFilter == GL_LINEAR) ? static_cast<float>(lodOffset) : -FLT_MAX;
-}
-
-FLOAT ConvertMaxLOD(GLenum minFilter, unsigned int lodOffset)
-{
- return (minFilter == GL_NEAREST || minFilter == GL_LINEAR) ? static_cast<float>(lodOffset) : FLT_MAX;
-}
-
-}
-
-namespace d3d11_gl
-{
-
-GLenum ConvertBackBufferFormat(DXGI_FORMAT format)
-{
- switch (format)
</del><ins>+ switch (queryType)
</ins><span class="cx"> {
</span><del>- case DXGI_FORMAT_R8G8B8A8_UNORM: return GL_RGBA8_OES;
- case DXGI_FORMAT_B8G8R8A8_UNORM: return GL_BGRA8_EXT;
- default:
- UNREACHABLE();
</del><ins>+ 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;
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- return GL_RGBA8_OES;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-GLenum ConvertDepthStencilFormat(DXGI_FORMAT format)
</del><ins>+namespace d3d11
</ins><span class="cx"> {
</span><del>- switch (format)
- {
- case DXGI_FORMAT_UNKNOWN: return GL_NONE;
- case DXGI_FORMAT_D16_UNORM: return GL_DEPTH_COMPONENT16;
- case DXGI_FORMAT_D24_UNORM_S8_UINT: return GL_DEPTH24_STENCIL8_OES;
- default:
- UNREACHABLE();
- }
</del><span class="cx">
</span><del>- return GL_DEPTH24_STENCIL8_OES;
-}
-
-GLenum ConvertRenderbufferFormat(DXGI_FORMAT format)
</del><ins>+void GenerateInitialTextureData(GLint internalFormat, GLuint clientVersion, GLuint width, GLuint height, GLuint depth,
+ GLuint mipLevels, std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData,
+ std::vector< std::vector<BYTE> > *outData)
</ins><span class="cx"> {
</span><del>- switch (format)
- {
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- return GL_BGRA8_EXT;
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- return GL_RGBA8_OES;
- case DXGI_FORMAT_D16_UNORM:
- return GL_DEPTH_COMPONENT16;
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- return GL_DEPTH24_STENCIL8_OES;
- default:
- UNREACHABLE();
- }
</del><ins>+ InitializeTextureDataFunction initializeFunc = gl_d3d11::GetTextureDataInitializationFunction(internalFormat);
+ DXGI_FORMAT dxgiFormat = gl_d3d11::GetTexFormat(internalFormat, clientVersion);
</ins><span class="cx">
</span><del>- return GL_RGBA8_OES;
-}
</del><ins>+ outSubresourceData->resize(mipLevels);
+ outData->resize(mipLevels);
</ins><span class="cx">
</span><del>-GLenum ConvertTextureInternalFormat(DXGI_FORMAT format)
-{
- switch (format)
</del><ins>+ for (unsigned int i = 0; i < mipLevels; i++)
</ins><span class="cx"> {
</span><del>- case DXGI_FORMAT_R8G8B8A8_UNORM:
- return GL_RGBA8_OES;
- case DXGI_FORMAT_A8_UNORM:
- return GL_ALPHA8_EXT;
- case DXGI_FORMAT_BC1_UNORM:
- return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- case DXGI_FORMAT_BC2_UNORM:
- return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
- case DXGI_FORMAT_BC3_UNORM:
- return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- return GL_RGBA32F_EXT;
- case DXGI_FORMAT_R32G32B32_FLOAT:
- return GL_RGB32F_EXT;
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- return GL_RGBA16F_EXT;
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- return GL_BGRA8_EXT;
- case DXGI_FORMAT_R8_UNORM:
- return GL_R8_EXT;
- case DXGI_FORMAT_R8G8_UNORM:
- return GL_RG8_EXT;
- case DXGI_FORMAT_R16_FLOAT:
- return GL_R16F_EXT;
- case DXGI_FORMAT_R16G16_FLOAT:
- return GL_RG16F_EXT;
- case DXGI_FORMAT_D16_UNORM:
- return GL_DEPTH_COMPONENT16;
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- return GL_DEPTH24_STENCIL8_OES;
- case DXGI_FORMAT_UNKNOWN:
- return GL_NONE;
- default:
- UNREACHABLE();
- }
</del><ins>+ unsigned int mipWidth = std::max(width >> i, 1U);
+ unsigned int mipHeight = std::max(height >> i, 1U);
+ unsigned int mipDepth = std::max(depth >> i, 1U);
</ins><span class="cx">
</span><del>- return GL_RGBA8_OES;
-}
</del><ins>+ unsigned int rowWidth = d3d11::GetFormatPixelBytes(dxgiFormat) * mipWidth;
+ unsigned int imageSize = rowWidth * height;
</ins><span class="cx">
</span><del>-}
</del><ins>+ outData->at(i).resize(rowWidth * mipHeight * mipDepth);
+ initializeFunc(mipWidth, mipHeight, mipDepth, outData->at(i).data(), rowWidth, imageSize);
</ins><span class="cx">
</span><del>-namespace gl_d3d11
-{
-
-DXGI_FORMAT ConvertRenderbufferFormat(GLenum format)
-{
- switch (format)
- {
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8_OES:
- case GL_RGB565:
- case GL_RGB8_OES:
- return DXGI_FORMAT_R8G8B8A8_UNORM;
- case GL_BGRA8_EXT:
- return DXGI_FORMAT_B8G8R8A8_UNORM;
- case GL_DEPTH_COMPONENT16:
- return DXGI_FORMAT_D16_UNORM;
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- return DXGI_FORMAT_D24_UNORM_S8_UINT;
- default:
- UNREACHABLE();
</del><ins>+ outSubresourceData->at(i).pSysMem = outData->at(i).data();
+ outSubresourceData->at(i).SysMemPitch = rowWidth;
+ outSubresourceData->at(i).SysMemSlicePitch = imageSize;
</ins><span class="cx"> }
</span><del>-
- return DXGI_FORMAT_R8G8B8A8_UNORM;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-DXGI_FORMAT ConvertTextureFormat(GLenum internalformat)
-{
- switch (internalformat)
- {
- case GL_RGB565:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB8_OES:
- case GL_RGBA8_OES:
- case GL_LUMINANCE8_EXT:
- case GL_LUMINANCE8_ALPHA8_EXT:
- return DXGI_FORMAT_R8G8B8A8_UNORM;
- case GL_ALPHA8_EXT:
- return DXGI_FORMAT_A8_UNORM;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return DXGI_FORMAT_BC1_UNORM;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- return DXGI_FORMAT_BC2_UNORM;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- return DXGI_FORMAT_BC3_UNORM;
- case GL_RGBA32F_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- return DXGI_FORMAT_R32G32B32A32_FLOAT;
- case GL_RGB32F_EXT:
- case GL_LUMINANCE32F_EXT:
- return DXGI_FORMAT_R32G32B32A32_FLOAT;
- case GL_RGBA16F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- case GL_RGB16F_EXT:
- case GL_LUMINANCE16F_EXT:
- return DXGI_FORMAT_R16G16B16A16_FLOAT;
- case GL_BGRA8_EXT:
- return DXGI_FORMAT_B8G8R8A8_UNORM;
- case GL_R8_EXT:
- return DXGI_FORMAT_R8_UNORM;
- case GL_RG8_EXT:
- return DXGI_FORMAT_R8G8_UNORM;
- case GL_R16F_EXT:
- return DXGI_FORMAT_R16_FLOAT;
- case GL_RG16F_EXT:
- return DXGI_FORMAT_R16G16_FLOAT;
- case GL_DEPTH_COMPONENT16:
- return DXGI_FORMAT_D16_UNORM;
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH24_STENCIL8_OES:
- return DXGI_FORMAT_D24_UNORM_S8_UINT;
- case GL_NONE:
- return DXGI_FORMAT_UNKNOWN;
- default:
- UNREACHABLE();
- }
-
- return DXGI_FORMAT_R8G8B8A8_UNORM;
-}
-
-}
-
-namespace d3d11
-{
-
</del><span class="cx"> void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v)
</span><span class="cx"> {
</span><span class="cx"> vertex->x = x;
</span><span class="lines">@@ -400,282 +255,17 @@
</span><span class="cx"> vertex->v = v;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void SetPositionDepthColorVertex(PositionDepthColorVertex* vertex, float x, float y, float z,
- const gl::Color &color)
</del><ins>+void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, float x, float y,
+ unsigned int layer, float u, float v, float s)
</ins><span class="cx"> {
</span><span class="cx"> vertex->x = x;
</span><span class="cx"> vertex->y = y;
</span><del>- vertex->z = z;
- vertex->r = color.red;
- vertex->g = color.green;
- vertex->b = color.blue;
- vertex->a = color.alpha;
</del><ins>+ vertex->l = layer;
+ vertex->u = u;
+ vertex->v = v;
+ vertex->s = s;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-size_t ComputePixelSizeBits(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_R1_UNORM:
- return 1;
-
- case DXGI_FORMAT_A8_UNORM:
- case DXGI_FORMAT_R8_SINT:
- case DXGI_FORMAT_R8_SNORM:
- case DXGI_FORMAT_R8_TYPELESS:
- case DXGI_FORMAT_R8_UINT:
- case DXGI_FORMAT_R8_UNORM:
- return 8;
-
- case DXGI_FORMAT_B5G5R5A1_UNORM:
- case DXGI_FORMAT_B5G6R5_UNORM:
- case DXGI_FORMAT_D16_UNORM:
- case DXGI_FORMAT_R16_FLOAT:
- case DXGI_FORMAT_R16_SINT:
- case DXGI_FORMAT_R16_SNORM:
- case DXGI_FORMAT_R16_TYPELESS:
- case DXGI_FORMAT_R16_UINT:
- case DXGI_FORMAT_R16_UNORM:
- case DXGI_FORMAT_R8G8_SINT:
- case DXGI_FORMAT_R8G8_SNORM:
- case DXGI_FORMAT_R8G8_TYPELESS:
- case DXGI_FORMAT_R8G8_UINT:
- case DXGI_FORMAT_R8G8_UNORM:
- return 16;
-
- case DXGI_FORMAT_B8G8R8X8_TYPELESS:
- case DXGI_FORMAT_B8G8R8X8_UNORM:
- case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- case DXGI_FORMAT_D32_FLOAT:
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- case DXGI_FORMAT_G8R8_G8B8_UNORM:
- case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
- case DXGI_FORMAT_R10G10B10A2_TYPELESS:
- case DXGI_FORMAT_R10G10B10A2_UINT:
- case DXGI_FORMAT_R10G10B10A2_UNORM:
- case DXGI_FORMAT_R11G11B10_FLOAT:
- case DXGI_FORMAT_R16G16_FLOAT:
- case DXGI_FORMAT_R16G16_SINT:
- case DXGI_FORMAT_R16G16_SNORM:
- case DXGI_FORMAT_R16G16_TYPELESS:
- case DXGI_FORMAT_R16G16_UINT:
- case DXGI_FORMAT_R16G16_UNORM:
- case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
- case DXGI_FORMAT_R24G8_TYPELESS:
- case DXGI_FORMAT_R32_FLOAT:
- case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
- case DXGI_FORMAT_R32_SINT:
- case DXGI_FORMAT_R32_TYPELESS:
- case DXGI_FORMAT_R32_UINT:
- case DXGI_FORMAT_R8G8_B8G8_UNORM:
- case DXGI_FORMAT_R8G8B8A8_SINT:
- case DXGI_FORMAT_R8G8B8A8_SNORM:
- case DXGI_FORMAT_R8G8B8A8_TYPELESS:
- case DXGI_FORMAT_R8G8B8A8_UINT:
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
- case DXGI_FORMAT_B8G8R8A8_TYPELESS:
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
- case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
- case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
- return 32;
-
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- case DXGI_FORMAT_R16G16B16A16_SINT:
- case DXGI_FORMAT_R16G16B16A16_SNORM:
- case DXGI_FORMAT_R16G16B16A16_TYPELESS:
- case DXGI_FORMAT_R16G16B16A16_UINT:
- case DXGI_FORMAT_R16G16B16A16_UNORM:
- case DXGI_FORMAT_R32G32_FLOAT:
- case DXGI_FORMAT_R32G32_SINT:
- case DXGI_FORMAT_R32G32_TYPELESS:
- case DXGI_FORMAT_R32G32_UINT:
- case DXGI_FORMAT_R32G8X24_TYPELESS:
- return 64;
-
- case DXGI_FORMAT_R32G32B32_FLOAT:
- case DXGI_FORMAT_R32G32B32_SINT:
- case DXGI_FORMAT_R32G32B32_TYPELESS:
- case DXGI_FORMAT_R32G32B32_UINT:
- return 96;
-
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- case DXGI_FORMAT_R32G32B32A32_SINT:
- case DXGI_FORMAT_R32G32B32A32_TYPELESS:
- case DXGI_FORMAT_R32G32B32A32_UINT:
- return 128;
-
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- return 4;
-
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return 8;
-
- default:
- return 0;
- }
-}
-
-size_t ComputeBlockSizeBits(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return ComputePixelSizeBits(format) * 16;
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-bool IsCompressed(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return true;
- case DXGI_FORMAT_UNKNOWN:
- UNREACHABLE();
- return false;
- default:
- return false;
- }
-}
-
-unsigned int GetTextureFormatDimensionAlignment(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_BC1_TYPELESS:
- case DXGI_FORMAT_BC1_UNORM:
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- case DXGI_FORMAT_BC4_SNORM:
- case DXGI_FORMAT_BC4_TYPELESS:
- case DXGI_FORMAT_BC4_UNORM:
- case DXGI_FORMAT_BC2_TYPELESS:
- case DXGI_FORMAT_BC2_UNORM:
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- case DXGI_FORMAT_BC3_TYPELESS:
- case DXGI_FORMAT_BC3_UNORM:
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- case DXGI_FORMAT_BC5_SNORM:
- case DXGI_FORMAT_BC5_TYPELESS:
- case DXGI_FORMAT_BC5_UNORM:
- case DXGI_FORMAT_BC6H_SF16:
- case DXGI_FORMAT_BC6H_TYPELESS:
- case DXGI_FORMAT_BC6H_UF16:
- case DXGI_FORMAT_BC7_TYPELESS:
- case DXGI_FORMAT_BC7_UNORM:
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return 4;
- case DXGI_FORMAT_UNKNOWN:
- UNREACHABLE();
- return 1;
- default:
- return 1;
- }
-}
-
-bool IsDepthStencilFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- case DXGI_FORMAT_D32_FLOAT:
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- case DXGI_FORMAT_D16_UNORM:
- return true;
- default:
- return false;
- }
-}
-
-DXGI_FORMAT GetDepthTextureFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: return DXGI_FORMAT_R32G8X24_TYPELESS;
- case DXGI_FORMAT_D32_FLOAT: return DXGI_FORMAT_R32_TYPELESS;
- case DXGI_FORMAT_D24_UNORM_S8_UINT: return DXGI_FORMAT_R24G8_TYPELESS;
- case DXGI_FORMAT_D16_UNORM: return DXGI_FORMAT_R16_TYPELESS;
- default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
- }
-}
-
-DXGI_FORMAT GetDepthShaderResourceFormat(DXGI_FORMAT format)
-{
- switch (format)
- {
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
- case DXGI_FORMAT_D32_FLOAT: return DXGI_FORMAT_R32_UINT;
- case DXGI_FORMAT_D24_UNORM_S8_UINT: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
- case DXGI_FORMAT_D16_UNORM: return DXGI_FORMAT_R16_UNORM;
- default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
- }
-}
-
</del><span class="cx"> HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
</span><span class="cx"> {
</span><span class="cx"> #if defined(_DEBUG)
</span><span class="lines">@@ -686,3 +276,5 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11renderer11_utilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/renderer11_utils.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,6 +12,9 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/angletypes.h"
</span><span class="cx">
</span><ins>+namespace rx
+{
+
</ins><span class="cx"> namespace gl_d3d11
</span><span class="cx"> {
</span><span class="cx">
</span><span class="lines">@@ -26,28 +29,20 @@
</span><span class="cx"> UINT8 ConvertStencilMask(GLuint stencilmask);
</span><span class="cx"> D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
</span><span class="cx">
</span><del>-D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy);
</del><ins>+D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode);
</ins><span class="cx"> D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
</span><del>-FLOAT ConvertMinLOD(GLenum minFilter, unsigned int lodOffset);
-FLOAT ConvertMaxLOD(GLenum minFilter, unsigned int lodOffset);
</del><span class="cx">
</span><del>-DXGI_FORMAT ConvertRenderbufferFormat(GLenum format);
-DXGI_FORMAT ConvertTextureFormat(GLenum format);
-}
</del><ins>+D3D11_QUERY ConvertQueryType(GLenum queryType);
</ins><span class="cx">
</span><del>-namespace d3d11_gl
-{
-
-GLenum ConvertBackBufferFormat(DXGI_FORMAT format);
-GLenum ConvertDepthStencilFormat(DXGI_FORMAT format);
-GLenum ConvertRenderbufferFormat(DXGI_FORMAT format);
-GLenum ConvertTextureInternalFormat(DXGI_FORMAT format);
-
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace d3d11
</span><span class="cx"> {
</span><span class="cx">
</span><ins>+void GenerateInitialTextureData(GLint internalFormat, GLuint clientVersion, GLuint width, GLuint height, GLuint depth,
+ GLuint mipLevels, std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData,
+ std::vector< std::vector<BYTE> > *outData);
+
</ins><span class="cx"> struct PositionTexCoordVertex
</span><span class="cx"> {
</span><span class="cx"> float x, y;
</span><span class="lines">@@ -55,26 +50,53 @@
</span><span class="cx"> };
</span><span class="cx"> void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v);
</span><span class="cx">
</span><ins>+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 <typename T>
</ins><span class="cx"> struct PositionDepthColorVertex
</span><span class="cx"> {
</span><span class="cx"> float x, y, z;
</span><del>- float r, g, b, a;
</del><ins>+ T r, g, b, a;
</ins><span class="cx"> };
</span><del>-void SetPositionDepthColorVertex(PositionDepthColorVertex* vertex, float x, float y, float z,
- const gl::Color &color);
</del><span class="cx">
</span><del>-size_t ComputePixelSizeBits(DXGI_FORMAT format);
-size_t ComputeBlockSizeBits(DXGI_FORMAT format);
</del><ins>+template <typename T>
+void SetPositionDepthColorVertex(PositionDepthColorVertex<T>* vertex, float x, float y, float z,
+ const gl::Color<T> &color)
+{
+ vertex->x = x;
+ vertex->y = y;
+ vertex->z = z;
+ vertex->r = color.red;
+ vertex->g = color.green;
+ vertex->b = color.blue;
+ vertex->a = color.alpha;
+}
</ins><span class="cx">
</span><del>-bool IsCompressed(DXGI_FORMAT format);
-unsigned int GetTextureFormatDimensionAlignment(DXGI_FORMAT format);
</del><ins>+HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
</ins><span class="cx">
</span><del>-bool IsDepthStencilFormat(DXGI_FORMAT format);
-DXGI_FORMAT GetDepthTextureFormat(DXGI_FORMAT format);
-DXGI_FORMAT GetDepthShaderResourceFormat(DXGI_FORMAT format);
</del><ins>+template <typename outType>
+outType* DynamicCastComObject(IUnknown* object)
+{
+ outType *outObject = NULL;
+ HRESULT result = object->QueryInterface(__uuidof(outType), reinterpret_cast<void**>(&outObject));
+ if (SUCCEEDED(result))
+ {
+ return outObject;
+ }
+ else
+ {
+ SafeRelease(outObject);
+ return NULL;
+ }
+}
</ins><span class="cx">
</span><del>-HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
-
</del><span class="cx"> inline bool isDeviceLostError(HRESULT errorCode)
</span><span class="cx"> {
</span><span class="cx"> switch (errorCode)
</span><span class="lines">@@ -90,6 +112,51 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template <unsigned int N>
+inline ID3D11VertexShader *CompileVS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
+{
+ ID3D11VertexShader *vs = NULL;
+ HRESULT result = device->CreateVertexShader(byteCode, N, NULL, &vs);
+ ASSERT(SUCCEEDED(result));
+ SetDebugName(vs, name);
+ return vs;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+template <unsigned int N>
+inline ID3D11GeometryShader *CompileGS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
+{
+ ID3D11GeometryShader *gs = NULL;
+ HRESULT result = device->CreateGeometryShader(byteCode, N, NULL, &gs);
+ ASSERT(SUCCEEDED(result));
+ SetDebugName(gs, name);
+ return gs;
+}
+
+template <unsigned int N>
+inline ID3D11PixelShader *CompilePS(ID3D11Device *device, const BYTE (&byteCode)[N], const char *name)
+{
+ ID3D11PixelShader *ps = NULL;
+ HRESULT result = device->CreatePixelShader(byteCode, N, NULL, &ps);
+ 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 <class T>
+inline void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBuffer, const T &value)
+{
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ context->Map(constantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+
+ memcpy(mappedResource.pData, &value, sizeof(T));
+
+ context->Unmap(constantBuffer, 0);
+}
+
+}
+
+}
+
</ins><span class="cx"> #endif // LIBGLESV2_RENDERER_RENDERER11_UTILS_H
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11shadersClear11hlsl"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Clear11.hlsl        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,38 +1,102 @@
</span><del>-void VS_Clear( in float3 inPosition : POSITION, in float4 inColor : COLOR,
- out float4 outPosition : SV_POSITION, out float4 outColor : COLOR)
</del><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)
</ins><span class="cx"> {
</span><span class="cx"> outPosition = float4(inPosition, 1.0f);
</span><span class="cx"> outColor = inColor;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Assume we are in SM4+, which has 8 color outputs
-struct PS_OutputMultiple
</del><ins>+struct PS_OutputFloat
</ins><span class="cx"> {
</span><del>-        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;
</del><ins>+ 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;
</ins><span class="cx"> };
</span><span class="cx">
</span><del>-PS_OutputMultiple PS_ClearMultiple(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
</del><ins>+PS_OutputFloat PS_ClearFloat(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
</ins><span class="cx"> {
</span><del>-        PS_OutputMultiple 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;
</del><ins>+ 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;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-float4 PS_ClearSingle(in float4 inPosition : SV_Position, in float4 inColor : COLOR) : SV_Target0
</del><ins>+
+void VS_ClearUint( in float3 inPosition : POSITION, in uint4 inColor : COLOR,
+ out float4 outPosition : SV_POSITION, out uint4 outColor : COLOR)
</ins><span class="cx"> {
</span><del>-        return inColor;
</del><ins>+ outPosition = float4(inPosition, 1.0f);
+ outColor = inColor;
</ins><span class="cx"> }
</span><ins>+
+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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11shadersPassthrough2D11hlsl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl (0 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl         (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/Passthrough2D11.hlsl        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -0,0 +1,111 @@
</span><ins>+Texture2D<float4> TextureF : register(t0);
+Texture2D<uint4> TextureUI : register(t0);
+Texture2D<int4> 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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d11shadersgenerate_shadersbat"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d11/shaders/generate_shaders.bat        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,18 +1,119 @@
</span><span class="cx"> @ECHO OFF
</span><span class="cx"> REM
</span><del>-REM Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+REM Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> REM Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> REM found in the LICENSE file.
</span><span class="cx"> REM
</span><span class="cx">
</span><span class="cx"> PATH %PATH%;%ProgramFiles(x86)%\Windows Kits\8.0\bin\x86;%DXSDK_DIR%\Utilities\bin\x86
</span><span class="cx">
</span><del>-fxc /E VS_Passthrough /T vs_4_0 /Fh compiled/passthrough11vs.h Passthrough11.hlsl
-fxc /E PS_PassthroughRGBA /T ps_4_0 /Fh compiled/passthroughrgba11ps.h Passthrough11.hlsl
-fxc /E PS_PassthroughRGB /T ps_4_0 /Fh compiled/passthroughrgb11ps.h Passthrough11.hlsl
-fxc /E PS_PassthroughLum /T ps_4_0 /Fh compiled/passthroughlum11ps.h Passthrough11.hlsl
-fxc /E PS_PassthroughLumAlpha /T ps_4_0 /Fh compiled/passthroughlumalpha11ps.h Passthrough11.hlsl
</del><ins>+setlocal
+set errorCount=0
+set successCount=0
+set debug=0
</ins><span class="cx">
</span><del>-fxc /E VS_Clear /T vs_4_0 /Fh compiled/clear11vs.h Clear11.hlsl
-fxc /E PS_ClearSingle /T ps_4_0 /Fh compiled/clearsingle11ps.h Clear11.hlsl
-fxc /E PS_ClearMultiple /T ps_4_0 /Fh compiled/clearmultiple11ps.h Clear11.hlsl
</del><ins>+if "%1" == "debug" (
+ set debug=1
+)
+if "%1" == "release" (
+ set debug=0
+)
+
+:: | Input file | Entry point | Type | Output file | Debug |
+call:BuildShader Passthrough2D11.hlsl VS_Passthrough2D vs_4_0 compiled\passthrough2d11vs.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughDepth2D ps_4_0 compiled\passthroughdepth2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGBA2D ps_4_0 compiled\passthroughrgba2d11ps.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_PassthroughRGB2D ps_4_0 compiled\passthroughrgb2d11ps.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_PassthroughRG2D ps_4_0 compiled\passthroughrg2d11ps.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_PassthroughR2D ps_4_0 compiled\passthroughr2d11ps.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 Passthrough2D11.hlsl PS_PassthroughLum2D ps_4_0 compiled\passthroughlum2d11ps.h %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughLumAlpha2D ps_4_0 compiled\passthroughlumalpha2d11ps.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_ClearFloat vs_4_0 compiled\clearfloat11vs.h %debug%
+call:BuildShader Clear11.hlsl PS_ClearFloat ps_4_0 compiled\clearfloat11ps.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 "buildCMD=fxc /nologo /E %entry% /T %type% /Fh %output% %input%"
+) else (
+ set "buildCMD=fxc /nologo /Zi /Od /E %entry% /T %type% /Fh %output% %input%"
+)
+
+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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9BufferStorage9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2013-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">@@ -22,7 +22,7 @@
</span><span class="cx">
</span><span class="cx"> BufferStorage9::~BufferStorage9()
</span><span class="cx"> {
</span><del>- delete[] mMemory;
</del><ins>+ SafeDeleteArray(mMemory);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BufferStorage9 *BufferStorage9::makeBufferStorage9(BufferStorage *bufferStorage)
</span><span class="lines">@@ -60,11 +60,29 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void BufferStorage9::copyData(BufferStorage* sourceStorage, unsigned int size,
+ unsigned int sourceOffset, unsigned int destOffset)
+{
+ BufferStorage9* source = makeBufferStorage9(sourceStorage);
+ if (source)
+ {
+ void* sourceMemory = reinterpret_cast<char*>(source->mMemory) + sourceOffset;
+ void* destMemory = reinterpret_cast<char*>(mMemory) + destOffset;
+
+ memcpy(destMemory, sourceMemory, size);
+ }
+}
+
</ins><span class="cx"> void BufferStorage9::clear()
</span><span class="cx"> {
</span><span class="cx"> mSize = 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void BufferStorage9::markTransformFeedbackUsage()
+{
+ UNREACHABLE();
+}
+
</ins><span class="cx"> unsigned int BufferStorage9::getSize() const
</span><span class="cx"> {
</span><span class="cx"> return mSize;
</span><span class="lines">@@ -75,4 +93,22 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// We do not suppot buffer mapping facility in D3D9
+bool BufferStorage9::isMapped() const
+{
+ UNREACHABLE();
+ return false;
</ins><span class="cx"> }
</span><ins>+
+void *BufferStorage9::map(GLbitfield access)
+{
+ UNREACHABLE();
+ return NULL;
+}
+
+void BufferStorage9::unmap()
+{
+ UNREACHABLE();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9BufferStorage9h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/BufferStorage9.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2013-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">@@ -24,10 +24,17 @@
</span><span class="cx">
</span><span class="cx"> virtual void *getData();
</span><span class="cx"> virtual void setData(const void* data, unsigned int size, unsigned int offset);
</span><ins>+ virtual void copyData(BufferStorage* sourceStorage, unsigned int size,
+ unsigned int sourceOffset, unsigned int destOffset);
</ins><span class="cx"> virtual void clear();
</span><ins>+ virtual void markTransformFeedbackUsage();
</ins><span class="cx"> virtual unsigned int getSize() const;
</span><span class="cx"> virtual bool supportsDirectBinding() const;
</span><span class="cx">
</span><ins>+ virtual bool isMapped() const;
+ virtual void *map(GLbitfield access);
+ virtual void unmap();
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(BufferStorage9);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Fence9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -23,21 +23,15 @@
</span><span class="cx">
</span><span class="cx"> Fence9::~Fence9()
</span><span class="cx"> {
</span><del>- if (mQuery)
- {
- mRenderer->freeEventQuery(mQuery);
- mQuery = NULL;
- }
</del><ins>+ SafeRelease(mQuery);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-GLboolean Fence9::isFence()
</del><ins>+bool Fence9::isSet() const
</ins><span class="cx"> {
</span><del>- // GL_NV_fence spec:
- // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
</del><span class="cx"> return mQuery != NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence9::setFence(GLenum condition)
</del><ins>+void Fence9::set()
</ins><span class="cx"> {
</span><span class="cx"> if (!mQuery)
</span><span class="cx"> {
</span><span class="lines">@@ -50,86 +44,29 @@
</span><span class="cx">
</span><span class="cx"> HRESULT result = mQuery->Issue(D3DISSUE_END);
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><del>-
- setCondition(condition);
- setStatus(GL_FALSE);
</del><span class="cx"> }
</span><span class="cx">
</span><del>-GLboolean Fence9::testFence()
</del><ins>+bool Fence9::test(bool flushCommandBuffer)
</ins><span class="cx"> {
</span><del>- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION, GL_TRUE);
- }
</del><ins>+ ASSERT(mQuery);
</ins><span class="cx">
</span><del>- HRESULT result = mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
</del><ins>+ DWORD getDataFlags = (flushCommandBuffer ? D3DGETDATA_FLUSH : 0);
+ HRESULT result = mQuery->GetData(NULL, 0, getDataFlags);
</ins><span class="cx">
</span><span class="cx"> if (d3d9::isDeviceLostError(result))
</span><span class="cx"> {
</span><span class="cx"> mRenderer->notifyDeviceLost();
</span><del>- return gl::error(GL_OUT_OF_MEMORY, GL_TRUE);
</del><ins>+ return gl::error(GL_OUT_OF_MEMORY, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT(result == S_OK || result == S_FALSE);
</span><del>- setStatus(result == S_OK);
- return getStatus();
-}
</del><span class="cx">
</span><del>-void Fence9::finishFence()
-{
- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- while (!testFence())
- {
- Sleep(0);
- }
</del><ins>+ return (result == S_OK);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Fence9::getFenceiv(GLenum pname, GLint *params)
</del><ins>+bool Fence9::hasError() const
</ins><span class="cx"> {
</span><del>- if (mQuery == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (pname)
- {
- case GL_FENCE_STATUS_NV:
- {
- // GL_NV_fence spec:
- // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
- // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
- if (getStatus())
- {
- params[0] = GL_TRUE;
- return;
- }
-
- HRESULT result = mQuery->GetData(NULL, 0, 0);
-
- if (d3d9::isDeviceLostError(result))
- {
- params[0] = GL_TRUE;
- mRenderer->notifyDeviceLost();
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- ASSERT(result == S_OK || result == S_FALSE);
- setStatus(result == S_OK);
- params[0] = getStatus();
-
- break;
- }
- case GL_FENCE_CONDITION_NV:
- params[0] = getCondition();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- break;
- }
</del><ins>+ return mRenderer->isDeviceLost();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Fence9h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Fence9.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -21,11 +21,10 @@
</span><span class="cx"> explicit Fence9(rx::Renderer9 *renderer);
</span><span class="cx"> virtual ~Fence9();
</span><span class="cx">
</span><del>- GLboolean isFence();
- void setFence(GLenum condition);
- GLboolean testFence();
- void finishFence();
- void getFenceiv(GLenum pname, GLint *params);
</del><ins>+ bool isSet() const;
+ void set();
+ bool test(bool flushCommandBuffer);
+ bool hasError() const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Fence9);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Image9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/TextureStorage9.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/renderer9_utils.h"
</span><del>-#include "libGLESv2/renderer/generatemip.h"
</del><ins>+#include "libGLESv2/renderer/d3d9/formatutils9.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -34,10 +34,7 @@
</span><span class="cx">
</span><span class="cx"> Image9::~Image9()
</span><span class="cx"> {
</span><del>- if (mSurface)
- {
- mSurface->Release();
- }
</del><ins>+ SafeRelease(mSurface);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface)
</span><span class="lines">@@ -54,6 +51,9 @@
</span><span class="cx"> ASSERT(sourceDesc.Width == 1 || sourceDesc.Width / 2 == destDesc.Width);
</span><span class="cx"> ASSERT(sourceDesc.Height == 1 || sourceDesc.Height / 2 == destDesc.Height);
</span><span class="cx">
</span><ins>+ MipGenerationFunction mipFunction = d3d9::GetMipGenerationFunction(sourceDesc.Format);
+ ASSERT(mipFunction != NULL);
+
</ins><span class="cx"> D3DLOCKED_RECT sourceLocked = {0};
</span><span class="cx"> result = sourceSurface->LockRect(&sourceLocked, NULL, D3DLOCK_READONLY);
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="lines">@@ -67,32 +67,12 @@
</span><span class="cx">
</span><span class="cx"> if (sourceData && destData)
</span><span class="cx"> {
</span><del>- switch (sourceDesc.Format)
- {
- case D3DFMT_L8:
- GenerateMip<L8>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A8L8:
- GenerateMip<A8L8>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_X8R8G8B8:
- GenerateMip<A8R8G8B8>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A16B16G16R16F:
- GenerateMip<A16B16G16R16F>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- case D3DFMT_A32B32G32R32F:
- GenerateMip<A32B32G32R32F>(sourceDesc.Width, sourceDesc.Height, sourceData, sourceLocked.Pitch, destData, destLocked.Pitch);
- break;
- default:
- UNREACHABLE();
- break;
- }
-
- destSurface->UnlockRect();
- sourceSurface->UnlockRect();
</del><ins>+ mipFunction(sourceDesc.Width, sourceDesc.Height, 1, sourceData, sourceLocked.Pitch, 0,
+ destData, destLocked.Pitch, 0);
</ins><span class="cx"> }
</span><ins>+
+ destSurface->UnlockRect();
+ sourceSurface->UnlockRect();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Image9 *Image9::makeImage9(Image *img)
</span><span class="lines">@@ -126,8 +106,10 @@
</span><span class="cx"> D3DSURFACE_DESC desc;
</span><span class="cx"> source->GetDesc(&desc);
</span><span class="cx">
</span><del>- int rows = d3d9::IsCompressedFormat(desc.Format) ? desc.Height / 4 : desc.Height;
- int bytes = d3d9::ComputeRowSize(desc.Format, desc.Width);
</del><ins>+ int blockHeight = d3d9::GetBlockHeight(desc.Format);
+ int rows = desc.Height / blockHeight;
+
+ int bytes = d3d9::GetBlockSize(desc.Format, desc.Width, blockHeight);
</ins><span class="cx"> ASSERT(bytes <= sourceLock.Pitch && bytes <= destLock.Pitch);
</span><span class="cx">
</span><span class="cx"> for(int i = 0; i < rows; i++)
</span><span class="lines">@@ -141,10 +123,17 @@
</span><span class="cx"> else UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image9::redefine(rx::Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease)
</del><ins>+bool Image9::redefine(rx::Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
</ins><span class="cx"> {
</span><ins>+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(depth <= 1);
+
+ // Only 2D and cube texture are supported by the D3D9 backend.
+ ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP);
+
</ins><span class="cx"> if (mWidth != width ||
</span><span class="cx"> mHeight != height ||
</span><ins>+ mDepth != depth ||
</ins><span class="cx"> mInternalFormat != internalformat ||
</span><span class="cx"> forceRelease)
</span><span class="cx"> {
</span><span class="lines">@@ -152,16 +141,16 @@
</span><span class="cx">
</span><span class="cx"> mWidth = width;
</span><span class="cx"> mHeight = height;
</span><ins>+ mDepth = depth;
</ins><span class="cx"> mInternalFormat = internalformat;
</span><ins>+
</ins><span class="cx"> // compute the d3d format that will be used
</span><del>- mD3DFormat = mRenderer->ConvertTextureInternalFormat(internalformat);
- mActualFormat = d3d9_gl::GetEquivalentFormat(mD3DFormat);
</del><ins>+ mD3DFormat = gl_d3d9::GetTextureFormat(internalformat, mRenderer);
+ mActualFormat = d3d9_gl::GetInternalFormat(mD3DFormat);
+ mRenderable = gl_d3d9::GetRenderFormat(internalformat, mRenderer) != D3DFMT_UNKNOWN;
</ins><span class="cx">
</span><del>- if (mSurface)
- {
- mSurface->Release();
- mSurface = NULL;
- }
</del><ins>+ SafeRelease(mSurface);
+ mDirty = gl_d3d9::RequiresTextureDataInitialization(mInternalFormat);
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -180,14 +169,13 @@
</span><span class="cx"> IDirect3DSurface9 *newSurface = NULL;
</span><span class="cx"> const D3DPOOL poolToUse = D3DPOOL_SYSTEMMEM;
</span><span class="cx"> const D3DFORMAT d3dFormat = getD3DFormat();
</span><del>- ASSERT(d3dFormat != D3DFMT_INTZ); // We should never get here for depth textures
</del><span class="cx">
</span><span class="cx"> if (mWidth != 0 && mHeight != 0)
</span><span class="cx"> {
</span><span class="cx"> int levelToFetch = 0;
</span><span class="cx"> GLsizei requestWidth = mWidth;
</span><span class="cx"> GLsizei requestHeight = mHeight;
</span><del>- gl::MakeValidSize(true, gl::IsCompressed(mInternalFormat), &requestWidth, &requestHeight, &levelToFetch);
</del><ins>+ d3d9::MakeValidSize(true, d3dFormat, &requestWidth, &requestHeight, &levelToFetch);
</ins><span class="cx">
</span><span class="cx"> IDirect3DDevice9 *device = mRenderer->getDevice();
</span><span class="cx">
</span><span class="lines">@@ -202,7 +190,27 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> newTexture->GetSurfaceLevel(levelToFetch, &newSurface);
</span><del>- newTexture->Release();
</del><ins>+ SafeRelease(newTexture);
+
+ if (gl_d3d9::RequiresTextureDataInitialization(mInternalFormat))
+ {
+ InitializeTextureDataFunction initializeFunc = gl_d3d9::GetTextureDataInitializationFunction(mInternalFormat);
+
+ RECT entireRect;
+ entireRect.left = 0;
+ entireRect.right = mWidth;
+ entireRect.top = 0;
+ entireRect.bottom = mHeight;
+
+ D3DLOCKED_RECT lockedRect;
+ result = newSurface->LockRect(&lockedRect, &entireRect, 0);
+ ASSERT(SUCCEEDED(result));
+
+ initializeFunc(mWidth, mHeight, 1, lockedRect.pBits, lockedRect.Pitch, 0);
+
+ result = newSurface->UnlockRect();
+ ASSERT(SUCCEEDED(result));
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mSurface = newSurface;
</span><span class="lines">@@ -236,11 +244,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image9::isRenderableFormat() const
-{
- return TextureStorage9::IsTextureFormatRenderable(getD3DFormat());
-}
-
</del><span class="cx"> D3DFORMAT Image9::getD3DFormat() const
</span><span class="cx"> {
</span><span class="cx"> // this should only happen if the image hasn't been redefined first
</span><span class="lines">@@ -250,6 +253,13 @@
</span><span class="cx"> return mD3DFormat;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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 || gl_d3d9::RequiresTextureDataInitialization(mInternalFormat)) && mDirty;
+}
+
</ins><span class="cx"> IDirect3DSurface9 *Image9::getSurface()
</span><span class="cx"> {
</span><span class="cx"> createSurface();
</span><span class="lines">@@ -280,7 +290,7 @@
</span><span class="cx"> if (mSurface)
</span><span class="cx"> {
</span><span class="cx"> copyLockableSurfaces(surface, mSurface);
</span><del>- mSurface->Release();
</del><ins>+ SafeRelease(mSurface);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mSurface = surface;
</span><span class="lines">@@ -288,22 +298,38 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image9::updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</del><ins>+bool Image9::copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(getSurface() != NULL);
</span><span class="cx"> TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage->getStorageInstance());
</span><del>- return updateSurface(storage9->getSurfaceLevel(level, true), xoffset, yoffset, width, height);
</del><ins>+ return copyToSurface(storage9->getSurfaceLevel(level, true), xoffset, yoffset, width, height);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image9::updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</del><ins>+bool Image9::copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(getSurface() != NULL);
</span><span class="cx"> TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage->getStorageInstance());
</span><del>- return updateSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true), xoffset, yoffset, width, height);
</del><ins>+ return copyToSurface(storage9->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true), xoffset, yoffset, width, height);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool Image9::updateSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
</del><ins>+bool Image9::copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
</ins><span class="cx"> {
</span><ins>+ // 3D textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
+bool Image9::copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height)
+{
+ // 2D array textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
+bool Image9::copyToSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+{
+ ASSERT(width > 0 && height > 0);
+
</ins><span class="cx"> if (!destSurface)
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -334,7 +360,7 @@
</span><span class="cx"> copyLockableSurfaces(surf, sourceSurface);
</span><span class="cx"> result = device->UpdateSurface(surf, &rect, destSurface, &point);
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><del>- surf->Release();
</del><ins>+ SafeRelease(surf);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -345,15 +371,24 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- destSurface->Release();
</del><ins>+ SafeRelease(destSurface);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
</span><span class="cx"> // into the target pixel rectangle.
</span><del>-void Image9::loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input)
</del><ins>+void Image9::loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input)
</ins><span class="cx"> {
</span><ins>+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(zoffset == 0 && depth == 1);
+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, type, clientVersion, width, unpackAlignment);
+
+ LoadImageFunction loadFunction = d3d9::GetImageLoadFunction(mInternalFormat, mRenderer);
+ ASSERT(loadFunction != NULL);
+
</ins><span class="cx"> RECT lockRect =
</span><span class="cx"> {
</span><span class="cx"> xoffset, yoffset,
</span><span class="lines">@@ -367,96 +402,32 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ loadFunction(width, height, depth, input, inputRowPitch, 0, locked.pBits, locked.Pitch, 0);
</ins><span class="cx">
</span><del>- GLsizei inputPitch = gl::ComputePitch(width, mInternalFormat, unpackAlignment);
-
- switch (mInternalFormat)
- {
- case GL_ALPHA8_EXT:
- if (gl::supportsSSE2())
- {
- loadAlphaDataToBGRASSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- else
- {
- loadAlphaDataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- break;
- case GL_LUMINANCE8_EXT:
- loadLuminanceDataToNativeOrBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits, getD3DFormat() == D3DFMT_L8);
- break;
- case GL_ALPHA32F_EXT:
- loadAlphaFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE32F_EXT:
- loadLuminanceFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_ALPHA16F_EXT:
- loadAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE16F_EXT:
- loadLuminanceHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE8_ALPHA8_EXT:
- loadLuminanceAlphaDataToNativeOrBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits, getD3DFormat() == D3DFMT_A8L8);
- break;
- case GL_LUMINANCE_ALPHA32F_EXT:
- loadLuminanceAlphaFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_LUMINANCE_ALPHA16F_EXT:
- loadLuminanceAlphaHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB8_OES:
- loadRGBUByteDataToBGRX(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB565:
- loadRGB565DataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGBA8_OES:
- if (gl::supportsSSE2())
- {
- loadRGBAUByteDataToBGRASSE2(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- else
- {
- loadRGBAUByteDataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- }
- break;
- case GL_RGBA4:
- loadRGBA4444DataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB5_A1:
- loadRGBA5551DataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_BGRA8_EXT:
- loadBGRADataToBGRA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
- case GL_RGB32F_EXT:
- loadRGBFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGB16F_EXT:
- loadRGBHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGBA32F_EXT:
- loadRGBAFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- case GL_RGBA16F_EXT:
- loadRGBAHalfFloatDataToRGBA(width, height, inputPitch, input, locked.Pitch, locked.pBits);
- break;
- default: UNREACHABLE();
- }
-
</del><span class="cx"> unlock();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
</del><ins>+void Image9::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
</ins><span class="cx"> const void *input)
</span><span class="cx"> {
</span><del>- ASSERT(xoffset % 4 == 0);
- ASSERT(yoffset % 4 == 0);
</del><ins>+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(zoffset == 0 && depth == 1);
</ins><span class="cx">
</span><del>- RECT lockRect = {
</del><ins>+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, 1);
+ GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
+
+ GLuint outputBlockWidth = d3d9::GetBlockWidth(mD3DFormat);
+ GLuint outputBlockHeight = d3d9::GetBlockHeight(mD3DFormat);
+
+ ASSERT(xoffset % outputBlockWidth == 0);
+ ASSERT(yoffset % outputBlockHeight == 0);
+
+ LoadImageFunction loadFunction = d3d9::GetImageLoadFunction(mInternalFormat, mRenderer);
+ ASSERT(loadFunction != NULL);
+
+ RECT lockRect =
+ {
</ins><span class="cx"> xoffset, yoffset,
</span><span class="cx"> xoffset + width, yoffset + height
</span><span class="cx"> };
</span><span class="lines">@@ -468,20 +439,18 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GLsizei inputSize = gl::ComputeCompressedSize(width, height, mInternalFormat);
- GLsizei inputPitch = gl::ComputeCompressedPitch(width, mInternalFormat);
- int rows = inputSize / inputPitch;
- for (int i = 0; i < rows; ++i)
- {
- memcpy((void*)((BYTE*)locked.pBits + i * locked.Pitch), (void*)((BYTE*)input + i * inputPitch), inputPitch);
- }
</del><ins>+ loadFunction(width, height, depth, input, inputRowPitch, inputDepthPitch,
+ locked.pBits, locked.Pitch, 0);
</ins><span class="cx">
</span><span class="cx"> unlock();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
</span><del>-void Image9::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
</del><ins>+void Image9::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
</ins><span class="cx"> {
</span><ins>+ // ES3.0 only behaviour to copy into a 3d texture
+ ASSERT(zoffset == 0);
+
</ins><span class="cx"> RenderTarget9 *renderTarget = NULL;
</span><span class="cx"> IDirect3DSurface9 *surface = NULL;
</span><span class="cx"> gl::Renderbuffer *colorbuffer = source->getColorbuffer(0);
</span><span class="lines">@@ -513,7 +482,7 @@
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ERR("Could not create matching destination surface.");
</span><del>- surface->Release();
</del><ins>+ SafeRelease(surface);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -522,8 +491,8 @@
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ERR("GetRenderTargetData unexpectedly failed.");
</span><del>- renderTargetData->Release();
- surface->Release();
</del><ins>+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -536,8 +505,8 @@
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ERR("Failed to lock the source surface (rectangle might be invalid).");
</span><del>- renderTargetData->Release();
- surface->Release();
</del><ins>+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -548,8 +517,8 @@
</span><span class="cx"> {
</span><span class="cx"> ERR("Failed to lock the destination surface (rectangle might be invalid).");
</span><span class="cx"> renderTargetData->UnlockRect();
</span><del>- renderTargetData->Release();
- surface->Release();
</del><ins>+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -723,10 +692,10 @@
</span><span class="cx"> unlock();
</span><span class="cx"> renderTargetData->UnlockRect();
</span><span class="cx">
</span><del>- renderTargetData->Release();
- surface->Release();
</del><ins>+ SafeRelease(renderTargetData);
+ SafeRelease(surface);
</ins><span class="cx">
</span><span class="cx"> mDirty = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Image9h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Image9.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -37,32 +37,33 @@
</span><span class="cx"> static void generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
</span><span class="cx"> static void copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
</span><span class="cx">
</span><del>- virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease);
</del><ins>+ virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
</ins><span class="cx">
</span><del>- virtual bool isRenderableFormat() const;
</del><span class="cx"> D3DFORMAT getD3DFormat() const;
</span><span class="cx">
</span><del>- virtual bool isDirty() const {return mSurface && mDirty;}
</del><ins>+ virtual bool isDirty() const;
</ins><span class="cx"> IDirect3DSurface9 *getSurface();
</span><span class="cx">
</span><span class="cx"> virtual void setManagedSurface(TextureStorageInterface2D *storage, int level);
</span><span class="cx"> virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level);
</span><del>- virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
- virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
</del><ins>+ virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+ virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
+ virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height);
</ins><span class="cx">
</span><del>- virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLint unpackAlignment, const void *input);
- virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
</del><ins>+ virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ GLint unpackAlignment, GLenum type, const void *input);
+ virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
</ins><span class="cx"> const void *input);
</span><span class="cx">
</span><del>- virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
</del><ins>+ virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset,GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Image9);
</span><span class="cx">
</span><span class="cx"> void createSurface();
</span><span class="cx"> void setManagedSurface(IDirect3DSurface9 *surface);
</span><del>- bool updateSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
</del><ins>+ bool copyToSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
</ins><span class="cx">
</span><span class="cx"> HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
</span><span class="cx"> void unlock();
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9IndexBuffer9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/IndexBuffer9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -23,20 +23,12 @@
</span><span class="cx">
</span><span class="cx"> IndexBuffer9::~IndexBuffer9()
</span><span class="cx"> {
</span><del>- if (mIndexBuffer)
- {
- mIndexBuffer->Release();
- mIndexBuffer = NULL;
- }
</del><ins>+ SafeRelease(mIndexBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool IndexBuffer9::initialize(unsigned int bufferSize, GLenum indexType, bool dynamic)
</span><span class="cx"> {
</span><del>- if (mIndexBuffer)
- {
- mIndexBuffer->Release();
- mIndexBuffer = NULL;
- }
</del><ins>+ SafeRelease(mIndexBuffer);
</ins><span class="cx">
</span><span class="cx"> updateSerial();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Query9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Query9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Query9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Query9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -24,11 +24,7 @@
</span><span class="cx">
</span><span class="cx"> Query9::~Query9()
</span><span class="cx"> {
</span><del>- if (mQuery)
- {
- mQuery->Release();
- mQuery = NULL;
- }
</del><ins>+ SafeRelease(mQuery);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Query9::begin()
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9RenderTarget9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -12,11 +12,13 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/Renderer9.h"
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/renderer9_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d9/formatutils9.h"
</ins><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><ins>+// TODO: AddRef the incoming surface to take ownership instead of expecting that its ref is being given.
</ins><span class="cx"> RenderTarget9::RenderTarget9(Renderer *renderer, IDirect3DSurface9 *surface)
</span><span class="cx"> {
</span><span class="cx"> mRenderer = Renderer9::makeRenderer9(renderer);
</span><span class="lines">@@ -29,20 +31,21 @@
</span><span class="cx">
</span><span class="cx"> mWidth = description.Width;
</span><span class="cx"> mHeight = description.Height;
</span><del>-
- mInternalFormat = d3d9_gl::GetEquivalentFormat(description.Format);
- mActualFormat = d3d9_gl::GetEquivalentFormat(description.Format);
- mSamples = d3d9_gl::GetSamplesFromMultisampleType(description.MultiSampleType);
</del><ins>+ mDepth = 1;
+
+ mInternalFormat = d3d9_gl::GetInternalFormat(description.Format);
+ mActualFormat = d3d9_gl::GetInternalFormat(description.Format);
+ mSamples = d3d9_gl::GetSamplesCount(description.MultiSampleType);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget9::RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples)
</del><ins>+RenderTarget9::RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples)
</ins><span class="cx"> {
</span><span class="cx"> mRenderer = Renderer9::makeRenderer9(renderer);
</span><span class="cx"> mRenderTarget = NULL;
</span><span class="cx">
</span><del>- D3DFORMAT requestedFormat = gl_d3d9::ConvertRenderbufferFormat(format);
- int supportedSamples = mRenderer->getNearestSupportedSamples(requestedFormat, samples);
</del><ins>+ D3DFORMAT renderFormat = gl_d3d9::GetRenderFormat(internalFormat, mRenderer);
+ int supportedSamples = mRenderer->getNearestSupportedSamples(renderFormat, samples);
</ins><span class="cx">
</span><span class="cx"> if (supportedSamples == -1)
</span><span class="cx"> {
</span><span class="lines">@@ -52,20 +55,29 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HRESULT result = D3DERR_INVALIDCALL;
</span><del>-
</del><ins>+
+ GLuint clientVersion = mRenderer->getCurrentClientVersion();
+
</ins><span class="cx"> if (width > 0 && height > 0)
</span><span class="cx"> {
</span><del>- if (requestedFormat == D3DFMT_D24S8)
</del><ins>+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ bool requiresInitialization = false;
+
+ if (gl::GetDepthBits(internalFormat, clientVersion) > 0 ||
+ gl::GetStencilBits(internalFormat, clientVersion) > 0)
</ins><span class="cx"> {
</span><del>- result = mRenderer->getDevice()->CreateDepthStencilSurface(width, height, requestedFormat,
- gl_d3d9::GetMultisampleTypeFromSamples(supportedSamples),
- 0, FALSE, &mRenderTarget, NULL);
</del><ins>+ result = device->CreateDepthStencilSurface(width, height, renderFormat,
+ gl_d3d9::GetMultisampleType(supportedSamples),
+ 0, FALSE, &mRenderTarget, NULL);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- result = mRenderer->getDevice()->CreateRenderTarget(width, height, requestedFormat,
- gl_d3d9::GetMultisampleTypeFromSamples(supportedSamples),
- 0, FALSE, &mRenderTarget, NULL);
</del><ins>+ requiresInitialization = gl_d3d9::RequiresTextureDataInitialization(internalFormat);
+
+ result = device->CreateRenderTarget(width, height, renderFormat,
+ gl_d3d9::GetMultisampleType(supportedSamples),
+ 0, FALSE, &mRenderTarget, NULL);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
</span><span class="lines">@@ -76,21 +88,31 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><ins>+
+ 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;
+ device->GetRenderTarget(0, &prevRenderTarget);
+ device->SetRenderTarget(0, mRenderTarget);
+ device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 255), 0.0f, 0);
+ device->SetRenderTarget(0, prevRenderTarget);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mWidth = width;
</span><span class="cx"> mHeight = height;
</span><del>- mInternalFormat = format;
</del><ins>+ mDepth = 1;
+ mInternalFormat = internalFormat;
</ins><span class="cx"> mSamples = supportedSamples;
</span><del>- mActualFormat = d3d9_gl::GetEquivalentFormat(requestedFormat);
</del><ins>+ mActualFormat = d3d9_gl::GetInternalFormat(renderFormat);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderTarget9::~RenderTarget9()
</span><span class="cx"> {
</span><del>- if (mRenderTarget)
- {
- mRenderTarget->Release();
- }
</del><ins>+ SafeRelease(mRenderTarget);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderTarget9 *RenderTarget9::makeRenderTarget9(RenderTarget *target)
</span><span class="lines">@@ -99,9 +121,15 @@
</span><span class="cx"> return static_cast<rx::RenderTarget9*>(target);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void RenderTarget9::invalidate(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ // Currently a no-op
+}
+
</ins><span class="cx"> IDirect3DSurface9 *RenderTarget9::getSurface()
</span><span class="cx"> {
</span><span class="cx"> // Caller is responsible for releasing the returned surface reference.
</span><ins>+ // TODO: remove the AddRef to match RenderTarget11
</ins><span class="cx"> if (mRenderTarget)
</span><span class="cx"> {
</span><span class="cx"> mRenderTarget->AddRef();
</span><span class="lines">@@ -110,4 +138,4 @@
</span><span class="cx"> return mRenderTarget;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9RenderTarget9h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/RenderTarget9.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -21,10 +21,13 @@
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx"> RenderTarget9(Renderer *renderer, IDirect3DSurface9 *surface);
</span><del>- RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples);
</del><ins>+ RenderTarget9(Renderer *renderer, GLsizei width, GLsizei height, GLenum internalFormat, GLsizei samples);
</ins><span class="cx"> virtual ~RenderTarget9();
</span><span class="cx">
</span><span class="cx"> static RenderTarget9 *makeRenderTarget9(RenderTarget *renderTarget);
</span><ins>+
+ virtual void invalidate(GLint x, GLint y, GLsizei width, GLsizei height);
+
</ins><span class="cx"> IDirect3DSurface9 *getSurface();
</span><span class="cx">
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Renderer9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,12 +1,14 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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"> // Renderer9.cpp: Implements a back-end specific class for the D3D9 renderer.
</span><span class="cx">
</span><ins>+#include "common/utilities.h"
+
</ins><span class="cx"> #include "libGLESv2/main.h"
</span><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx"> #include "libGLESv2/Texture.h"
</span><span class="lines">@@ -16,17 +18,19 @@
</span><span class="cx"> #include "libGLESv2/renderer/IndexDataManager.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/Renderer9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/renderer9_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d9/formatutils9.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d9/ShaderExecutable9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/SwapChain9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/TextureStorage9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/Image9.h"
</span><del>-#include "libGLESv2/renderer/d3d9/Blit.h"
</del><ins>+#include "libGLESv2/renderer/d3d9/Blit9.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d9/RenderTarget9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/IndexBuffer9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/BufferStorage9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/Query9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/Fence9.h"
</span><ins>+#include "libGLESv2/angletypes.h"
</ins><span class="cx">
</span><span class="cx"> #include "libEGL/Display.h"
</span><span class="cx">
</span><span class="lines">@@ -43,6 +47,13 @@
</span><span class="cx"> #define ANGLE_ENABLE_D3D9EX 1
</span><span class="cx"> #endif // !defined(ANGLE_ENABLE_D3D9EX)
</span><span class="cx">
</span><ins>+#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
+#endif
+
+const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
+const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
+
</ins><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx"> static const D3DFORMAT RenderTargetFormats[] =
</span><span class="lines">@@ -117,6 +128,9 @@
</span><span class="cx"> mNullColorbufferCache[i].height = 0;
</span><span class="cx"> mNullColorbufferCache[i].buffer = NULL;
</span><span class="cx"> }
</span><ins>+
+ mAppliedVertexShader = NULL;
+ mAppliedPixelShader = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderer9::~Renderer9()
</span><span class="lines">@@ -142,22 +156,15 @@
</span><span class="cx"> SafeRelease(mD3d9);
</span><span class="cx"> SafeRelease(mD3d9Ex);
</span><span class="cx">
</span><ins>+ mCompiler.release();
+
</ins><span class="cx"> if (mDeviceWindow)
</span><span class="cx"> {
</span><span class="cx"> DestroyWindow(mDeviceWindow);
</span><span class="cx"> mDeviceWindow = NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (mD3d9Module)
- {
- mD3d9Module = NULL;
- }
-
- while (!mMultiSampleSupport.empty())
- {
- delete [] mMultiSampleSupport.begin()->second;
- mMultiSampleSupport.erase(mMultiSampleSupport.begin());
- }
</del><ins>+ mD3d9Module = NULL;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Renderer9 *Renderer9::makeRenderer9(Renderer *renderer)
</span><span class="lines">@@ -168,7 +175,7 @@
</span><span class="cx">
</span><span class="cx"> EGLint Renderer9::initialize()
</span><span class="cx"> {
</span><del>- if (!initializeCompiler())
</del><ins>+ if (!mCompiler.initialize())
</ins><span class="cx"> {
</span><span class="cx"> return EGL_NOT_INITIALIZED;
</span><span class="cx"> }
</span><span class="lines">@@ -200,7 +207,7 @@
</span><span class="cx"> {
</span><span class="cx"> TRACE_EVENT0("gpu", "D3d9Ex_QueryInterface");
</span><span class="cx"> ASSERT(mD3d9Ex);
</span><del>- mD3d9Ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
</del><ins>+ mD3d9Ex->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast<void**>(&mD3d9));
</ins><span class="cx"> ASSERT(mD3d9);
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -251,7 +258,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // When DirectX9 is running with an older DirectX8 driver, a StretchRect from a regular texture to a render target texture is not supported.
</span><del>- // This is required by Texture2D::convertToRenderTarget.
</del><ins>+ // This is required by Texture2D::ensureRenderTarget.
</ins><span class="cx"> if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
</span><span class="cx"> {
</span><span class="cx"> ERR("Renderer does not support stretctrect from textures!\n");
</span><span class="lines">@@ -301,48 +308,17 @@
</span><span class="cx"> mMaxSwapInterval = std::max(mMaxSwapInterval, 4);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- int max = 0;
</del><ins>+ mMaxSupportedSamples = 0;
+
+ const d3d9::D3DFormatSet &d3d9Formats = d3d9::GetAllUsedD3DFormats();
+ for (d3d9::D3DFormatSet::const_iterator i = d3d9Formats.begin(); i != d3d9Formats.end(); ++i)
</ins><span class="cx"> {
</span><span class="cx"> TRACE_EVENT0("gpu", "getMultiSampleSupport");
</span><del>- for (unsigned int i = 0; i < ArraySize(RenderTargetFormats); ++i)
- {
- bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1];
- getMultiSampleSupport(RenderTargetFormats[i], multisampleArray);
- mMultiSampleSupport[RenderTargetFormats[i]] = multisampleArray;
-
- for (int j = D3DMULTISAMPLE_16_SAMPLES; j >= 0; --j)
- {
- if (multisampleArray[j] && j != D3DMULTISAMPLE_NONMASKABLE && j > max)
- {
- max = j;
- }
- }
- }
</del><ins>+ MultisampleSupportInfo support = getMultiSampleSupport(*i);
+ mMultiSampleSupport[*i] = support;
+ mMaxSupportedSamples = std::max(mMaxSupportedSamples, support.maxSupportedSamples);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- {
- TRACE_EVENT0("gpu", "getMultiSampleSupport2");
- for (unsigned int i = 0; i < ArraySize(DepthStencilFormats); ++i)
- {
- if (DepthStencilFormats[i] == D3DFMT_UNKNOWN)
- continue;
-
- bool *multisampleArray = new bool[D3DMULTISAMPLE_16_SAMPLES + 1];
- getMultiSampleSupport(DepthStencilFormats[i], multisampleArray);
- mMultiSampleSupport[DepthStencilFormats[i]] = multisampleArray;
-
- for (int j = D3DMULTISAMPLE_16_SAMPLES; j >= 0; --j)
- {
- if (multisampleArray[j] && j != D3DMULTISAMPLE_NONMASKABLE && j > max)
- {
- max = j;
- }
- }
- }
- }
-
- mMaxSupportedSamples = max;
-
</del><span class="cx"> static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
</span><span class="cx"> static const TCHAR className[] = TEXT("STATIC");
</span><span class="cx">
</span><span class="lines">@@ -378,7 +354,7 @@
</span><span class="cx"> if (mD3d9Ex)
</span><span class="cx"> {
</span><span class="cx"> TRACE_EVENT0("gpu", "mDevice_QueryInterface");
</span><del>- result = mDevice->QueryInterface(IID_IDirect3DDevice9Ex, (void**) &mDeviceEx);
</del><ins>+ result = mDevice->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void**)&mDeviceEx);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -394,7 +370,7 @@
</span><span class="cx"> TRACE_EVENT0("gpu", "device_CreateQuery");
</span><span class="cx"> if (SUCCEEDED(mDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &occlusionQuery)) && occlusionQuery)
</span><span class="cx"> {
</span><del>- occlusionQuery->Release();
</del><ins>+ SafeRelease(occlusionQuery);
</ins><span class="cx"> mOcclusionQuerySupport = true;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -409,7 +385,7 @@
</span><span class="cx"> TRACE_EVENT0("gpu", "device_CreateQuery2");
</span><span class="cx"> if (SUCCEEDED(mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &eventQuery)) && eventQuery)
</span><span class="cx"> {
</span><del>- eventQuery->Release();
</del><ins>+ SafeRelease(eventQuery);
</ins><span class="cx"> mEventQuerySupport = true;
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -428,6 +404,10 @@
</span><span class="cx"> SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
</span><span class="cx"> D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F));
</span><span class="cx">
</span><ins>+ // Check RGB565 texture support
+ mRGB565TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
+ D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_R5G6B5));
+
</ins><span class="cx"> // Check depth texture support
</span><span class="cx"> // we use INTZ for depth textures in Direct3D9
</span><span class="cx"> // we also want NULL texture support to ensure the we can make depth-only FBOs
</span><span class="lines">@@ -483,6 +463,25 @@
</span><span class="cx"> mFloat16TextureSupport = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ D3DFORMAT rgTextureFormats[] =
+ {
+ D3DFMT_R16F,
+ D3DFMT_G16R16F,
+ D3DFMT_R32F,
+ D3DFMT_G32R32F,
+ };
+
+ mRGTextureSupport = true;
+ for (unsigned int i = 0; i < ArraySize(rgTextureFormats); i++)
+ {
+ D3DFORMAT fmt = rgTextureFormats[i];
+ mRGTextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, D3DRTYPE_TEXTURE, fmt)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, fmt)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, D3DRTYPE_CUBETEXTURE, fmt)) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_CUBETEXTURE, fmt));
+ }
+
+
</ins><span class="cx"> // Check DXT texture support
</span><span class="cx"> mDXT1TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
</span><span class="cx"> mDXT3TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3));
</span><span class="lines">@@ -494,6 +493,8 @@
</span><span class="cx">
</span><span class="cx"> initializeDevice();
</span><span class="cx">
</span><ins>+ d3d9::InitializeVertexTranslations(this);
+
</ins><span class="cx"> return EGL_SUCCESS;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -520,7 +521,7 @@
</span><span class="cx"> mSceneStarted = false;
</span><span class="cx">
</span><span class="cx"> ASSERT(!mBlit && !mVertexDataManager && !mIndexDataManager);
</span><del>- mBlit = new Blit(this);
</del><ins>+ mBlit = new Blit9(this);
</ins><span class="cx"> mVertexDataManager = new rx::VertexDataManager(this);
</span><span class="cx"> mIndexDataManager = new rx::IndexDataManager(this);
</span><span class="cx"> }
</span><span class="lines">@@ -585,10 +586,11 @@
</span><span class="cx"> if (SUCCEEDED(result))
</span><span class="cx"> {
</span><span class="cx"> ConfigDesc newConfig;
</span><del>- newConfig.renderTargetFormat = d3d9_gl::ConvertBackBufferFormat(renderTargetFormat);
- newConfig.depthStencilFormat = d3d9_gl::ConvertDepthStencilFormat(depthStencilFormat);
</del><ins>+ newConfig.renderTargetFormat = d3d9_gl::GetInternalFormat(renderTargetFormat);
+ newConfig.depthStencilFormat = d3d9_gl::GetInternalFormat(depthStencilFormat);
</ins><span class="cx"> newConfig.multiSample = 0; // FIXME: enumerate multi-sampling
</span><span class="cx"> newConfig.fastConfig = (currentDisplayMode.Format == renderTargetFormat);
</span><ins>+ newConfig.es3Capable = false;
</ins><span class="cx">
</span><span class="cx"> (*configDescList)[numConfigs++] = newConfig;
</span><span class="cx"> }
</span><span class="lines">@@ -696,7 +698,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (mEventQueryPool.size() > 1000)
</span><span class="cx"> {
</span><del>- query->Release();
</del><ins>+ SafeRelease(query);
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><span class="lines">@@ -751,6 +753,26 @@
</span><span class="cx"> return new Fence9(this);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
+bool Renderer9::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
+{
+ // Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
+ UNREACHABLE();
+ return false;
+}
+
+void Renderer9::generateSwizzle(gl::Texture *texture)
+{
+ // Swizzled textures are not available in ES2 or D3D9
+ UNREACHABLE();
+}
+
</ins><span class="cx"> void Renderer9::setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &samplerState)
</span><span class="cx"> {
</span><span class="cx"> bool *forceSetSamplers = (type == gl::SAMPLER_PIXEL) ? mForceSetPixelSamplerStates : mForceSetVertexSamplerStates;
</span><span class="lines">@@ -769,7 +791,7 @@
</span><span class="cx"> gl_d3d9::ConvertMinFilter(samplerState.minFilter, &d3dMinFilter, &d3dMipFilter, samplerState.maxAnisotropy);
</span><span class="cx"> mDevice->SetSamplerState(d3dSampler, D3DSAMP_MINFILTER, d3dMinFilter);
</span><span class="cx"> mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPFILTER, d3dMipFilter);
</span><del>- mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXMIPLEVEL, samplerState.lodOffset);
</del><ins>+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXMIPLEVEL, samplerState.baseLevel);
</ins><span class="cx"> if (mSupportsTextureFilterAnisotropy)
</span><span class="cx"> {
</span><span class="cx"> mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, (DWORD)samplerState.maxAnisotropy);
</span><span class="lines">@@ -814,6 +836,12 @@
</span><span class="cx"> appliedSerials[index] = serial;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer9::setUniformBuffers(const gl::Buffer* /*vertexUniformBuffers*/[], const gl::Buffer* /*fragmentUniformBuffers*/[])
+{
+ // No effect in ES2/D3D9
+ return true;
+}
+
</ins><span class="cx"> void Renderer9::setRasterizerState(const gl::RasterizerState &rasterState)
</span><span class="cx"> {
</span><span class="cx"> bool rasterStateChanged = mForceSetRasterState || memcmp(&rasterState, &mCurRasterState, sizeof(gl::RasterizerState)) != 0;
</span><span class="lines">@@ -852,10 +880,11 @@
</span><span class="cx"> mForceSetRasterState = false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor, unsigned int sampleMask)
</del><ins>+void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
+ unsigned int sampleMask)
</ins><span class="cx"> {
</span><span class="cx"> bool blendStateChanged = mForceSetBlendState || memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0;
</span><del>- bool blendColorChanged = mForceSetBlendState || memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0;
</del><ins>+ bool blendColorChanged = mForceSetBlendState || memcmp(&blendColor, &mCurBlendColor, sizeof(gl::ColorF)) != 0;
</ins><span class="cx"> bool sampleMaskChanged = mForceSetBlendState || sampleMask != mCurSampleMask;
</span><span class="cx">
</span><span class="cx"> if (blendStateChanged || blendColorChanged)
</span><span class="lines">@@ -906,6 +935,10 @@
</span><span class="cx"> FIXME("Sample alpha to coverage is unimplemented.");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::Renderbuffer *renderBuffer = framebuffer->getFirstColorbuffer();
+ GLenum internalFormat = renderBuffer ? renderBuffer->getInternalFormat() : GL_NONE;
+ GLuint clientVersion = getCurrentClientVersion();
+
</ins><span class="cx"> // Set the color mask
</span><span class="cx"> bool zeroColorMaskAllowed = getAdapterVendor() != VENDOR_ID_AMD;
</span><span class="cx"> // Apparently some ATI cards have a bug where a draw with a zero color
</span><span class="lines">@@ -914,8 +947,10 @@
</span><span class="cx"> // drawing is done.
</span><span class="cx"> // http://code.google.com/p/angleproject/issues/detail?id=169
</span><span class="cx">
</span><del>- DWORD colorMask = gl_d3d9::ConvertColorMask(blendState.colorMaskRed, blendState.colorMaskGreen,
- blendState.colorMaskBlue, blendState.colorMaskAlpha);
</del><ins>+ DWORD colorMask = gl_d3d9::ConvertColorMask(gl::GetRedBits(internalFormat, clientVersion) > 0 && blendState.colorMaskRed,
+ gl::GetGreenBits(internalFormat, clientVersion) > 0 && blendState.colorMaskGreen,
+ gl::GetBlueBits(internalFormat, clientVersion) > 0 && blendState.colorMaskBlue,
+ gl::GetAlphaBits(internalFormat, clientVersion) > 0 && blendState.colorMaskAlpha);
</ins><span class="cx"> if (colorMask == 0 && !zeroColorMaskAllowed)
</span><span class="cx"> {
</span><span class="cx"> // Enable green channel, but set blending so nothing will be drawn.
</span><span class="lines">@@ -1278,7 +1313,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mDevice->SetRenderTarget(0, renderTargetSurface);
</span><del>- renderTargetSurface->Release();
</del><ins>+ SafeRelease(renderTargetSurface);
</ins><span class="cx">
</span><span class="cx"> mAppliedRenderTargetSerial = renderTargetSerial;
</span><span class="cx"> renderTargetChanged = true;
</span><span class="lines">@@ -1335,7 +1370,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mDevice->SetDepthStencilSurface(depthStencilSurface);
</span><del>- depthStencilSurface->Release();
</del><ins>+ SafeRelease(depthStencilSurface);
</ins><span class="cx">
</span><span class="cx"> depthSize = depthStencil->getDepthSize();
</span><span class="cx"> stencilSize = depthStencil->getStencilSize();
</span><span class="lines">@@ -1366,6 +1401,7 @@
</span><span class="cx"> {
</span><span class="cx"> mForceSetScissor = true;
</span><span class="cx"> mForceSetViewport = true;
</span><ins>+ mForceSetBlendState = true;
</ins><span class="cx">
</span><span class="cx"> mRenderTargetDesc.width = renderbufferObject->getWidth();
</span><span class="cx"> mRenderTargetDesc.height = renderbufferObject->getHeight();
</span><span class="lines">@@ -1376,15 +1412,16 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances)
</del><ins>+GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances)
</ins><span class="cx"> {
</span><span class="cx"> TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
</span><del>- GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
</del><ins>+ GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, currentValues, programBinary, first, count, attributes, instances);
</ins><span class="cx"> if (err != GL_NO_ERROR)
</span><span class="cx"> {
</span><span class="cx"> return err;
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, programBinary, instances, &mRepeatDraw);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1410,10 +1447,17 @@
</span><span class="cx"> return err;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
</del><ins>+void Renderer9::applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[])
</ins><span class="cx"> {
</span><ins>+ UNREACHABLE();
+}
+
+void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive)
+{
+ ASSERT(!transformFeedbackActive);
+
</ins><span class="cx"> startScene();
</span><del>-
</del><ins>+
</ins><span class="cx"> if (mode == GL_LINE_LOOP)
</span><span class="cx"> {
</span><span class="cx"> drawLineLoop(count, GL_NONE, NULL, 0, NULL);
</span><span class="lines">@@ -1448,7 +1492,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei /*instances*/)
</del><ins>+void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei /*instances*/)
</ins><span class="cx"> {
</span><span class="cx"> startScene();
</span><span class="cx">
</span><span class="lines">@@ -1498,15 +1543,15 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Checked by Renderer9::applyPrimitiveType
+ ASSERT(count >= 0);
+
</ins><span class="cx"> if (static_cast<unsigned int>(count) + 1 > (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
</span><span class="cx"> {
</span><span class="cx"> ERR("Could not create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required.");
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Checked by Renderer9::applyPrimitiveType
- ASSERT(count >= 0);
-
</del><span class="cx"> const unsigned int spaceNeeded = (static_cast<unsigned int>(count) + 1) * sizeof(unsigned int);
</span><span class="cx"> if (!mLineLoopIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT))
</span><span class="cx"> {
</span><span class="lines">@@ -1688,34 +1733,46 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::applyShaders(gl::ProgramBinary *programBinary)
</del><ins>+void Renderer9::applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[])
</ins><span class="cx"> {
</span><del>- unsigned int programBinarySerial = programBinary->getSerial();
- if (programBinarySerial != mAppliedProgramBinarySerial)
- {
- ShaderExecutable *vertexExe = programBinary->getVertexExecutable();
- ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
</del><ins>+ ASSERT(!transformFeedbackActive);
+ ASSERT(!rasterizerDiscard);
</ins><span class="cx">
</span><del>- IDirect3DVertexShader9 *vertexShader = NULL;
- if (vertexExe) vertexShader = ShaderExecutable9::makeShaderExecutable9(vertexExe)->getVertexShader();
</del><ins>+ ShaderExecutable *vertexExe = programBinary->getVertexExecutableForInputLayout(inputLayout);
+ ShaderExecutable *pixelExe = programBinary->getPixelExecutable();
</ins><span class="cx">
</span><del>- IDirect3DPixelShader9 *pixelShader = NULL;
- if (pixelExe) pixelShader = ShaderExecutable9::makeShaderExecutable9(pixelExe)->getPixelShader();
</del><ins>+ IDirect3DVertexShader9 *vertexShader = (vertexExe ? ShaderExecutable9::makeShaderExecutable9(vertexExe)->getVertexShader() : NULL);
+ IDirect3DPixelShader9 *pixelShader = (pixelExe ? ShaderExecutable9::makeShaderExecutable9(pixelExe)->getPixelShader() : NULL);
</ins><span class="cx">
</span><del>- mDevice->SetPixelShader(pixelShader);
</del><ins>+ bool dirtyUniforms = false;
+
+ if (vertexShader != mAppliedVertexShader)
+ {
</ins><span class="cx"> mDevice->SetVertexShader(vertexShader);
</span><del>- programBinary->dirtyAllUniforms();
- mDxUniformsDirty = true;
</del><ins>+ mAppliedVertexShader = vertexShader;
+ dirtyUniforms = true;
+ }
</ins><span class="cx">
</span><del>- mAppliedProgramBinarySerial = programBinarySerial;
</del><ins>+ if (pixelShader != mAppliedPixelShader)
+ {
+ mDevice->SetPixelShader(pixelShader);
+ mAppliedPixelShader = pixelShader;
+ dirtyUniforms = true;
</ins><span class="cx"> }
</span><ins>+
+ if (dirtyUniforms)
+ {
+ programBinary->dirtyAllUniforms();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray)
</del><ins>+void Renderer9::applyUniforms(const gl::ProgramBinary &programBinary)
</ins><span class="cx"> {
</span><del>- for (std::vector<gl::Uniform*>::const_iterator ub = uniformArray->begin(), ue = uniformArray->end(); ub != ue; ++ub)
</del><ins>+ const std::vector<gl::LinkedUniform*> &uniformArray = programBinary.getUniforms();
+
+ for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++)
</ins><span class="cx"> {
</span><del>- gl::Uniform *targetUniform = *ub;
</del><ins>+ gl::LinkedUniform *targetUniform = uniformArray[uniformIndex];
</ins><span class="cx">
</span><span class="cx"> if (targetUniform->dirty)
</span><span class="cx"> {
</span><span class="lines">@@ -1751,8 +1808,6 @@
</span><span class="cx"> default:
</span><span class="cx"> UNREACHABLE();
</span><span class="cx"> }
</span><del>-
- targetUniform->dirty = false;
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1765,20 +1820,20 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v)
</del><ins>+void Renderer9::applyUniformnfv(gl::LinkedUniform *targetUniform, const GLfloat *v)
</ins><span class="cx"> {
</span><del>- if (targetUniform->psRegisterIndex >= 0)
</del><ins>+ if (targetUniform->isReferencedByFragmentShader())
</ins><span class="cx"> {
</span><span class="cx"> mDevice->SetPixelShaderConstantF(targetUniform->psRegisterIndex, v, targetUniform->registerCount);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (targetUniform->vsRegisterIndex >= 0)
</del><ins>+ if (targetUniform->isReferencedByVertexShader())
</ins><span class="cx"> {
</span><span class="cx"> mDevice->SetVertexShaderConstantF(targetUniform->vsRegisterIndex, v, targetUniform->registerCount);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::applyUniformniv(gl::Uniform *targetUniform, const GLint *v)
</del><ins>+void Renderer9::applyUniformniv(gl::LinkedUniform *targetUniform, const GLint *v)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(targetUniform->registerCount <= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
</span><span class="cx"> GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
</span><span class="lines">@@ -1794,7 +1849,7 @@
</span><span class="cx"> applyUniformnfv(targetUniform, (GLfloat*)vector);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::applyUniformnbv(gl::Uniform *targetUniform, const GLint *v)
</del><ins>+void Renderer9::applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(targetUniform->registerCount <= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
</span><span class="cx"> GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
</span><span class="lines">@@ -1812,28 +1867,71 @@
</span><span class="cx">
</span><span class="cx"> void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
</span><span class="cx"> {
</span><del>- D3DCOLOR color = D3DCOLOR_ARGB(gl::unorm<8>(clearParams.colorClearValue.alpha),
- gl::unorm<8>(clearParams.colorClearValue.red),
- gl::unorm<8>(clearParams.colorClearValue.green),
- gl::unorm<8>(clearParams.colorClearValue.blue));
</del><ins>+ if (clearParams.colorClearType != GL_FLOAT)
+ {
+ // Clearing buffers with non-float values is not supported by Renderer9 and ES 2.0
+ UNREACHABLE();
+ return;
+ }
+
+ bool clearColor = clearParams.clearColor[0];
+ for (unsigned int i = 0; i < 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;
+ }
+ }
+
</ins><span class="cx"> float depth = gl::clamp01(clearParams.depthClearValue);
</span><del>- int stencil = clearParams.stencilClearValue & 0x000000FF;
</del><ins>+ DWORD stencil = clearParams.stencilClearValue & 0x000000FF;
</ins><span class="cx">
</span><span class="cx"> unsigned int stencilUnmasked = 0x0;
</span><del>- if ((clearParams.mask & GL_STENCIL_BUFFER_BIT) && frameBuffer->hasStencil())
</del><ins>+ if (clearParams.clearStencil && frameBuffer->hasStencil())
</ins><span class="cx"> {
</span><del>- unsigned int stencilSize = gl::GetStencilSize(frameBuffer->getStencilbuffer()->getActualFormat());
</del><ins>+ unsigned int stencilSize = gl::GetStencilBits(frameBuffer->getStencilbuffer()->getActualFormat(),
+ getCurrentClientVersion());
</ins><span class="cx"> stencilUnmasked = (0x1 << stencilSize) - 1;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool alphaUnmasked = (gl::GetAlphaSize(mRenderTargetDesc.format) == 0) || clearParams.colorMaskAlpha;
-
- const bool needMaskedStencilClear = (clearParams.mask & GL_STENCIL_BUFFER_BIT) &&
</del><ins>+ const bool needMaskedStencilClear = clearParams.clearStencil &&
</ins><span class="cx"> (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
</span><del>- const bool needMaskedColorClear = (clearParams.mask & GL_COLOR_BUFFER_BIT) &&
- !(clearParams.colorMaskRed && clearParams.colorMaskGreen &&
- clearParams.colorMaskBlue && alphaUnmasked);
</del><span class="cx">
</span><ins>+ bool needMaskedColorClear = false;
+ D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0);
+ if (clearColor)
+ {
+ gl::Renderbuffer *renderbuffer = frameBuffer->getFirstColorbuffer();
+ GLenum internalFormat = renderbuffer->getInternalFormat();
+ GLenum actualFormat = renderbuffer->getActualFormat();
+
+ GLuint clientVersion = getCurrentClientVersion();
+ GLuint internalRedBits = gl::GetRedBits(internalFormat, clientVersion);
+ GLuint internalGreenBits = gl::GetGreenBits(internalFormat, clientVersion);
+ GLuint internalBlueBits = gl::GetBlueBits(internalFormat, clientVersion);
+ GLuint internalAlphaBits = gl::GetAlphaBits(internalFormat, clientVersion);
+
+ GLuint actualRedBits = gl::GetRedBits(actualFormat, clientVersion);
+ GLuint actualGreenBits = gl::GetGreenBits(actualFormat, clientVersion);
+ GLuint actualBlueBits = gl::GetBlueBits(actualFormat, clientVersion);
+ GLuint actualAlphaBits = gl::GetAlphaBits(actualFormat, clientVersion);
+
+ color = D3DCOLOR_ARGB(gl::unorm<8>((internalAlphaBits == 0 && actualAlphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha),
+ gl::unorm<8>((internalRedBits == 0 && actualRedBits > 0) ? 0.0f : clearParams.colorFClearValue.red),
+ gl::unorm<8>((internalGreenBits == 0 && actualGreenBits > 0) ? 0.0f : clearParams.colorFClearValue.green),
+ gl::unorm<8>((internalBlueBits == 0 && actualBlueBits > 0) ? 0.0f : clearParams.colorFClearValue.blue));
+
+ if ((internalRedBits > 0 && !clearParams.colorMaskRed) ||
+ (internalGreenBits > 0 && !clearParams.colorMaskGreen) ||
+ (internalBlueBits > 0 && !clearParams.colorMaskBlue) ||
+ (internalAlphaBits > 0 && !clearParams.colorMaskAlpha))
+ {
+ needMaskedColorClear = true;
+ }
+ }
+
</ins><span class="cx"> if (needMaskedColorClear || needMaskedStencilClear)
</span><span class="cx"> {
</span><span class="cx"> // State which is altered in all paths from this point to the clear call is saved.
</span><span class="lines">@@ -1893,7 +1991,7 @@
</span><span class="cx"> mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
</span><span class="cx"> mDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
</span><span class="cx">
</span><del>- if (clearParams.mask & GL_COLOR_BUFFER_BIT)
</del><ins>+ if (clearColor)
</ins><span class="cx"> {
</span><span class="cx"> mDevice->SetRenderState(D3DRS_COLORWRITEENABLE,
</span><span class="cx"> gl_d3d9::ConvertColorMask(clearParams.colorMaskRed,
</span><span class="lines">@@ -1906,7 +2004,7 @@
</span><span class="cx"> mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (stencilUnmasked != 0x0 && (clearParams.mask & GL_STENCIL_BUFFER_BIT))
</del><ins>+ if (stencilUnmasked != 0x0 && clearParams.clearStencil)
</ins><span class="cx"> {
</span><span class="cx"> mDevice->SetRenderState(D3DRS_STENCILENABLE, TRUE);
</span><span class="cx"> mDevice->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, FALSE);
</span><span class="lines">@@ -1962,7 +2060,7 @@
</span><span class="cx"> startScene();
</span><span class="cx"> mDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float[4]));
</span><span class="cx">
</span><del>- if (clearParams.mask & GL_DEPTH_BUFFER_BIT)
</del><ins>+ if (clearParams.clearDepth)
</ins><span class="cx"> {
</span><span class="cx"> mDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
</span><span class="cx"> mDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
</span><span class="lines">@@ -1974,18 +2072,18 @@
</span><span class="cx"> mMaskedClearSavedState->Apply();
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- else if (clearParams.mask)
</del><ins>+ else if (clearColor || clearParams.clearDepth || clearParams.clearStencil)
</ins><span class="cx"> {
</span><span class="cx"> DWORD dxClearFlags = 0;
</span><del>- if (clearParams.mask & GL_COLOR_BUFFER_BIT)
</del><ins>+ if (clearColor)
</ins><span class="cx"> {
</span><span class="cx"> dxClearFlags |= D3DCLEAR_TARGET;
</span><span class="cx"> }
</span><del>- if (clearParams.mask & GL_DEPTH_BUFFER_BIT)
</del><ins>+ if (clearParams.clearDepth)
</ins><span class="cx"> {
</span><span class="cx"> dxClearFlags |= D3DCLEAR_ZBUFFER;
</span><span class="cx"> }
</span><del>- if (clearParams.mask & GL_STENCIL_BUFFER_BIT)
</del><ins>+ if (clearParams.clearStencil)
</ins><span class="cx"> {
</span><span class="cx"> dxClearFlags |= D3DCLEAR_STENCIL;
</span><span class="cx"> }
</span><span class="lines">@@ -2020,7 +2118,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mAppliedIBSerial = 0;
</span><del>- mAppliedProgramBinarySerial = 0;
</del><ins>+ mAppliedVertexShader = NULL;
+ mAppliedPixelShader = NULL;
</ins><span class="cx"> mDxUniformsDirty = true;
</span><span class="cx">
</span><span class="cx"> mVertexDeclarationCache.markStateDirty();
</span><span class="lines">@@ -2028,11 +2127,11 @@
</span><span class="cx">
</span><span class="cx"> void Renderer9::releaseDeviceResources()
</span><span class="cx"> {
</span><del>- while (!mEventQueryPool.empty())
</del><ins>+ for (size_t i = 0; i < mEventQueryPool.size(); i++)
</ins><span class="cx"> {
</span><del>- mEventQueryPool.back()->Release();
- mEventQueryPool.pop_back();
</del><ins>+ SafeRelease(mEventQueryPool[i]);
</ins><span class="cx"> }
</span><ins>+ mEventQueryPool.clear();
</ins><span class="cx">
</span><span class="cx"> SafeRelease(mMaskedClearSavedState);
</span><span class="cx">
</span><span class="lines">@@ -2048,10 +2147,8 @@
</span><span class="cx"> {
</span><span class="cx"> SafeDelete(mNullColorbufferCache[i].buffer);
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> void Renderer9::notifyDeviceLost()
</span><span class="cx"> {
</span><span class="cx"> mDeviceLost = true;
</span><span class="lines">@@ -2255,15 +2352,30 @@
</span><span class="cx"> return mAdapterIdentifier.DeviceIdentifier;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
</del><ins>+Renderer9::MultisampleSupportInfo Renderer9::getMultiSampleSupport(D3DFORMAT format)
</ins><span class="cx"> {
</span><del>- for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
</del><ins>+ MultisampleSupportInfo support = { 0 };
+
+ for (unsigned int multiSampleIndex = 0; multiSampleIndex < ArraySize(support.supportedSamples); multiSampleIndex++)
</ins><span class="cx"> {
</span><del>- HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format,
- TRUE, (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
</del><ins>+ HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format, TRUE,
+ (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
</ins><span class="cx">
</span><del>- multiSampleArray[multiSampleIndex] = SUCCEEDED(result);
</del><ins>+ if (SUCCEEDED(result))
+ {
+ support.supportedSamples[multiSampleIndex] = true;
+ if (multiSampleIndex != D3DMULTISAMPLE_NONMASKABLE)
+ {
+ support.maxSupportedSamples = std::max(support.maxSupportedSamples, multiSampleIndex);
+ }
+ }
+ else
+ {
+ support.supportedSamples[multiSampleIndex] = false;
+ }
</ins><span class="cx"> }
</span><ins>+
+ return support;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Renderer9::getBGRATextureSupport() const
</span><span class="lines">@@ -2272,17 +2384,17 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getDXT1TextureSupport()
</del><ins>+bool Renderer9::getDXT1TextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mDXT1TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getDXT3TextureSupport()
</del><ins>+bool Renderer9::getDXT3TextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mDXT3TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getDXT5TextureSupport()
</del><ins>+bool Renderer9::getDXT5TextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mDXT5TextureSupport;
</span><span class="cx"> }
</span><span class="lines">@@ -2292,35 +2404,67 @@
</span><span class="cx"> return mDepthTextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getFloat32TextureSupport(bool *filtering, bool *renderable)
</del><ins>+bool Renderer9::getFloat32TextureSupport() const
</ins><span class="cx"> {
</span><del>- *filtering = mFloat32FilterSupport;
- *renderable = mFloat32RenderSupport;
</del><span class="cx"> return mFloat32TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getFloat16TextureSupport(bool *filtering, bool *renderable)
</del><ins>+bool Renderer9::getFloat32TextureFilteringSupport() const
</ins><span class="cx"> {
</span><del>- *filtering = mFloat16FilterSupport;
- *renderable = mFloat16RenderSupport;
</del><ins>+ return mFloat32FilterSupport;
+}
+
+bool Renderer9::getFloat32TextureRenderingSupport() const
+{
+ return mFloat32RenderSupport;
+}
+
+bool Renderer9::getFloat16TextureSupport() const
+{
</ins><span class="cx"> return mFloat16TextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getLuminanceTextureSupport()
</del><ins>+bool Renderer9::getFloat16TextureFilteringSupport() const
</ins><span class="cx"> {
</span><ins>+ return mFloat16FilterSupport;
+}
+
+bool Renderer9::getFloat16TextureRenderingSupport() const
+{
+ return mFloat16RenderSupport;
+}
+
+bool Renderer9::getRGB565TextureSupport() const
+{
+ return mRGB565TextureSupport;
+}
+
+bool Renderer9::getLuminanceTextureSupport() const
+{
</ins><span class="cx"> return mLuminanceTextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getLuminanceAlphaTextureSupport()
</del><ins>+bool Renderer9::getLuminanceAlphaTextureSupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mLuminanceAlphaTextureSupport;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer9::getRGTextureSupport() const
+{
+ return mRGTextureSupport;
+}
+
</ins><span class="cx"> bool Renderer9::getTextureFilterAnisotropySupport() const
</span><span class="cx"> {
</span><span class="cx"> return mSupportsTextureFilterAnisotropy;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer9::getPBOSupport() const
+{
+ // D3D9 cannot support PBOs
+ return false;
+}
+
</ins><span class="cx"> float Renderer9::getTextureMaxAnisotropy() const
</span><span class="cx"> {
</span><span class="cx"> if (mSupportsTextureFilterAnisotropy)
</span><span class="lines">@@ -2330,7 +2474,7 @@
</span><span class="cx"> return 1.0f;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Renderer9::getEventQuerySupport()
</del><ins>+bool Renderer9::getEventQuerySupport() const
</ins><span class="cx"> {
</span><span class="cx"> return mEventQuerySupport;
</span><span class="cx"> }
</span><span class="lines">@@ -2373,6 +2517,46 @@
</span><span class="cx"> return (getMajorShaderModel() >= 3) ? MAX_VARYING_VECTORS_SM3 : MAX_VARYING_VECTORS_SM2;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned int Renderer9::getMaxVertexShaderUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxFragmentShaderUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getReservedVertexUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getReservedFragmentUniformBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxTransformFeedbackBuffers() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxTransformFeedbackSeparateComponents() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxTransformFeedbackInterleavedComponents() const
+{
+ return 0;
+}
+
+unsigned int Renderer9::getMaxUniformBufferSize() const
+{
+ return 0;
+}
+
</ins><span class="cx"> bool Renderer9::getNonPower2TextureSupport() const
</span><span class="cx"> {
</span><span class="cx"> return mSupportsNonPower2Textures;
</span><span class="lines">@@ -2404,6 +2588,20 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int Renderer9::getMaxRecommendedElementsIndices() const
+{
+ // ES3 only
+ UNREACHABLE();
+ return 0;
+}
+
+int Renderer9::getMaxRecommendedElementsVertices() const
+{
+ // ES3 only
+ UNREACHABLE();
+ return 0;
+}
+
</ins><span class="cx"> int Renderer9::getMajorShaderModel() const
</span><span class="cx"> {
</span><span class="cx"> return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion);
</span><span class="lines">@@ -2418,7 +2616,7 @@
</span><span class="cx"> int Renderer9::getMaxViewportDimension() const
</span><span class="cx"> {
</span><span class="cx"> int maxTextureDimension = std::min(std::min(getMaxTextureWidth(), getMaxTextureHeight()),
</span><del>- (int)gl::IMPLEMENTATION_MAX_TEXTURE_SIZE);
</del><ins>+ (int)gl::IMPLEMENTATION_MAX_2D_TEXTURE_SIZE);
</ins><span class="cx"> return maxTextureDimension;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2432,6 +2630,18 @@
</span><span class="cx"> return (int)mDeviceCaps.MaxTextureHeight;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int Renderer9::getMaxTextureDepth() const
+{
+ // 3D textures are not available in the D3D9 backend.
+ return 1;
+}
+
+int Renderer9::getMaxTextureArrayLayers() const
+{
+ // 2D array textures are not available in the D3D9 backend.
+ return 1;
+}
+
</ins><span class="cx"> bool Renderer9::get32BitIndexSupport() const
</span><span class="cx"> {
</span><span class="cx"> return mDeviceCaps.MaxVertexIndex >= (1 << 16);
</span><span class="lines">@@ -2457,6 +2667,53 @@
</span><span class="cx"> return mMaxSupportedSamples;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLsizei Renderer9::getMaxSupportedFormatSamples(GLenum internalFormat) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator itr = mMultiSampleSupport.find(format);
+ return (itr != mMultiSampleSupport.end()) ? mMaxSupportedSamples : 0;
+}
+
+GLsizei Renderer9::getNumSampleCounts(GLenum internalFormat) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
+
+ unsigned int numCounts = 0;
+ if (iter != mMultiSampleSupport.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ for (int i = 0; i < D3DMULTISAMPLE_16_SAMPLES; i++)
+ {
+ if (i != D3DMULTISAMPLE_NONMASKABLE && info.supportedSamples[i])
+ {
+ numCounts++;
+ }
+ }
+ }
+
+ return numCounts;
+}
+
+void Renderer9::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
+{
+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
+ MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
+
+ if (iter != mMultiSampleSupport.end())
+ {
+ const MultisampleSupportInfo& info = iter->second;
+ int bufPos = 0;
+ for (int i = D3DMULTISAMPLE_16_SAMPLES; i >= 0 && bufPos < bufSize; i--)
+ {
+ if (i != D3DMULTISAMPLE_NONMASKABLE && info.supportedSamples[i])
+ {
+ params[bufPos++] = i;
+ }
+ }
+ }
+}
+
</ins><span class="cx"> int Renderer9::getNearestSupportedSamples(D3DFORMAT format, int requested) const
</span><span class="cx"> {
</span><span class="cx"> if (requested == 0)
</span><span class="lines">@@ -2464,7 +2721,7 @@
</span><span class="cx"> return requested;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- std::map<D3DFORMAT, bool *>::const_iterator itr = mMultiSampleSupport.find(format);
</del><ins>+ MultisampleSupportMap::const_iterator itr = mMultiSampleSupport.find(format);
</ins><span class="cx"> if (itr == mMultiSampleSupport.end())
</span><span class="cx"> {
</span><span class="cx"> if (format == D3DFMT_UNKNOWN)
</span><span class="lines">@@ -2472,9 +2729,9 @@
</span><span class="cx"> return -1;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (int i = requested; i <= D3DMULTISAMPLE_16_SAMPLES; ++i)
</del><ins>+ for (unsigned int i = requested; i < ArraySize(itr->second.supportedSamples); ++i)
</ins><span class="cx"> {
</span><del>- if (itr->second[i] && i != D3DMULTISAMPLE_NONMASKABLE)
</del><ins>+ if (itr->second.supportedSamples[i] && i != D3DMULTISAMPLE_NONMASKABLE)
</ins><span class="cx"> {
</span><span class="cx"> return i;
</span><span class="cx"> }
</span><span class="lines">@@ -2489,7 +2746,7 @@
</span><span class="cx"> return 1;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLint internalformat)
</del><ins>+D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLenum internalformat)
</ins><span class="cx"> {
</span><span class="cx"> switch (internalformat)
</span><span class="cx"> {
</span><span class="lines">@@ -2545,19 +2802,21 @@
</span><span class="cx"> TextureStorage9_2D *source9 = TextureStorage9_2D::makeTextureStorage9_2D(source->getStorageInstance());
</span><span class="cx"> TextureStorage9_2D *dest9 = TextureStorage9_2D::makeTextureStorage9_2D(dest->getStorageInstance());
</span><span class="cx">
</span><del>- int levels = source9->levelCount();
</del><ins>+ int levels = source9->getLevelCount();
</ins><span class="cx"> for (int i = 0; i < levels; ++i)
</span><span class="cx"> {
</span><span class="cx"> IDirect3DSurface9 *srcSurf = source9->getSurfaceLevel(i, false);
</span><span class="cx"> IDirect3DSurface9 *dstSurf = dest9->getSurfaceLevel(i, false);
</span><del>-
</del><ins>+
</ins><span class="cx"> result = copyToRenderTarget(dstSurf, srcSurf, source9->isManaged());
</span><span class="cx">
</span><del>- if (srcSurf) srcSurf->Release();
- if (dstSurf) dstSurf->Release();
</del><ins>+ SafeRelease(srcSurf);
+ SafeRelease(dstSurf);
</ins><span class="cx">
</span><span class="cx"> if (!result)
</span><ins>+ {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2572,7 +2831,7 @@
</span><span class="cx"> {
</span><span class="cx"> TextureStorage9_Cube *source9 = TextureStorage9_Cube::makeTextureStorage9_Cube(source->getStorageInstance());
</span><span class="cx"> TextureStorage9_Cube *dest9 = TextureStorage9_Cube::makeTextureStorage9_Cube(dest->getStorageInstance());
</span><del>- int levels = source9->levelCount();
</del><ins>+ int levels = source9->getLevelCount();
</ins><span class="cx"> for (int f = 0; f < 6; f++)
</span><span class="cx"> {
</span><span class="cx"> for (int i = 0; i < levels; i++)
</span><span class="lines">@@ -2582,11 +2841,13 @@
</span><span class="cx">
</span><span class="cx"> result = copyToRenderTarget(dstSurf, srcSurf, source9->isManaged());
</span><span class="cx">
</span><del>- if (srcSurf) srcSurf->Release();
- if (dstSurf) dstSurf->Release();
</del><ins>+ SafeRelease(srcSurf);
+ SafeRelease(dstSurf);
</ins><span class="cx">
</span><span class="cx"> if (!result)
</span><ins>+ {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2594,6 +2855,20 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer9::copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source)
+{
+ // 3D textures are not available in the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
+bool Renderer9::copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source)
+{
+ // 2D array textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
</ins><span class="cx"> D3DPOOL Renderer9::getBufferPool(DWORD usage) const
</span><span class="cx"> {
</span><span class="cx"> if (mD3d9Ex != NULL)
</span><span class="lines">@@ -2635,9 +2910,27 @@
</span><span class="cx"> return mBlit->copy(framebuffer, rect, destFormat, xoffset, yoffset, storage, target, level);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level)
+{
+ // 3D textures are not available in the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
+bool Renderer9::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level)
+{
+ // 2D array textures are not available in the D3D9 backend.
+ UNREACHABLE();
+ return false;
+}
+
</ins><span class="cx"> bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &readRect, gl::Framebuffer *drawFramebuffer, const gl::Rectangle &drawRect,
</span><del>- bool blitRenderTarget, bool blitDepthStencil)
</del><ins>+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter)
</ins><span class="cx"> {
</span><ins>+ ASSERT(filter == GL_NEAREST);
+
</ins><span class="cx"> endScene();
</span><span class="cx">
</span><span class="cx"> if (blitRenderTarget)
</span><span class="lines">@@ -2673,6 +2966,9 @@
</span><span class="cx"> return gl::error(GL_OUT_OF_MEMORY, false);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::Extents srcSize(readRenderTarget->getWidth(), readRenderTarget->getHeight(), 1);
+ gl::Extents dstSize(drawRenderTarget->getWidth(), drawRenderTarget->getHeight(), 1);
+
</ins><span class="cx"> RECT srcRect;
</span><span class="cx"> srcRect.left = readRect.x;
</span><span class="cx"> srcRect.right = readRect.x + readRect.width;
</span><span class="lines">@@ -2685,10 +2981,79 @@
</span><span class="cx"> dstRect.top = drawRect.y;
</span><span class="cx"> dstRect.bottom = drawRect.y + drawRect.height;
</span><span class="cx">
</span><ins>+ // Clip the rectangles to the scissor rectangle
+ if (scissor)
+ {
+ if (dstRect.left < scissor->x)
+ {
+ srcRect.left += (scissor->x - dstRect.left);
+ dstRect.left = scissor->x;
+ }
+ if (dstRect.top < scissor->y)
+ {
+ srcRect.top += (scissor->y - dstRect.top);
+ dstRect.top = scissor->y;
+ }
+ if (dstRect.right > scissor->x + scissor->width)
+ {
+ srcRect.right -= (dstRect.right - (scissor->x + scissor->width));
+ dstRect.right = scissor->x + scissor->width;
+ }
+ if (dstRect.bottom > scissor->y + scissor->height)
+ {
+ srcRect.bottom -= (dstRect.bottom - (scissor->y + scissor->height));
+ dstRect.bottom = scissor->y + scissor->height;
+ }
+ }
+
+ // Clip the rectangles to the destination size
+ if (dstRect.left < 0)
+ {
+ srcRect.left += -dstRect.left;
+ dstRect.left = 0;
+ }
+ if (dstRect.right > dstSize.width)
+ {
+ srcRect.right -= (dstRect.right - dstSize.width);
+ dstRect.right = dstSize.width;
+ }
+ if (dstRect.top < 0)
+ {
+ srcRect.top += -dstRect.top;
+ dstRect.top = 0;
+ }
+ if (dstRect.bottom > dstSize.height)
+ {
+ srcRect.bottom -= (dstRect.bottom - dstSize.height);
+ dstRect.bottom = dstSize.height;
+ }
+
+ // Clip the rectangles to the source size
+ if (srcRect.left < 0)
+ {
+ dstRect.left += -srcRect.left;
+ srcRect.left = 0;
+ }
+ if (srcRect.right > srcSize.width)
+ {
+ dstRect.right -= (srcRect.right - srcSize.width);
+ srcRect.right = srcSize.width;
+ }
+ if (srcRect.top < 0)
+ {
+ dstRect.top += -srcRect.top;
+ srcRect.top = 0;
+ }
+ if (srcRect.bottom > srcSize.height)
+ {
+ dstRect.bottom -= (srcRect.bottom - srcSize.height);
+ srcRect.bottom = srcSize.height;
+ }
+
</ins><span class="cx"> HRESULT result = mDevice->StretchRect(readSurface, &srcRect, drawSurface, &dstRect, D3DTEXF_NONE);
</span><span class="cx">
</span><del>- readSurface->Release();
- drawSurface->Release();
</del><ins>+ SafeRelease(readSurface);
+ SafeRelease(drawSurface);
</ins><span class="cx">
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="lines">@@ -2697,7 +3062,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (blitDepthStencil)
</del><ins>+ if (blitDepth || blitStencil)
</ins><span class="cx"> {
</span><span class="cx"> gl::Renderbuffer *readBuffer = readFramebuffer->getDepthOrStencilbuffer();
</span><span class="cx"> gl::Renderbuffer *drawBuffer = drawFramebuffer->getDepthOrStencilbuffer();
</span><span class="lines">@@ -2732,8 +3097,8 @@
</span><span class="cx">
</span><span class="cx"> HRESULT result = mDevice->StretchRect(readSurface, NULL, drawSurface, NULL, D3DTEXF_NONE);
</span><span class="cx">
</span><del>- readSurface->Release();
- drawSurface->Release();
</del><ins>+ SafeRelease(readSurface);
+ SafeRelease(drawSurface);
</ins><span class="cx">
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="lines">@@ -2745,9 +3110,11 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels)
</del><ins>+void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels)
</ins><span class="cx"> {
</span><ins>+ ASSERT(pack.pixelBuffer.get() == NULL);
+
</ins><span class="cx"> RenderTarget9 *renderTarget = NULL;
</span><span class="cx"> IDirect3DSurface9 *surface = NULL;
</span><span class="cx"> gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0);
</span><span class="lines">@@ -2756,7 +3123,7 @@
</span><span class="cx"> {
</span><span class="cx"> renderTarget = RenderTarget9::makeRenderTarget9(colorbuffer->getRenderTarget());
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> if (renderTarget)
</span><span class="cx"> {
</span><span class="cx"> surface = renderTarget->getSurface();
</span><span class="lines">@@ -2774,13 +3141,13 @@
</span><span class="cx"> if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
</span><span class="cx"> {
</span><span class="cx"> UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render target
</span><del>- surface->Release();
</del><ins>+ SafeRelease(surface);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> HRESULT result;
</span><span class="cx"> IDirect3DSurface9 *systemSurface = NULL;
</span><del>- bool directToPixels = !packReverseRowOrder && packAlignment <= 4 && getShareHandleSupport() &&
</del><ins>+ bool directToPixels = !pack.reverseRowOrder && pack.alignment <= 4 && getShareHandleSupport() &&
</ins><span class="cx"> x == 0 && y == 0 && UINT(width) == desc.Width && UINT(height) == desc.Height &&
</span><span class="cx"> desc.Format == D3DFMT_A8R8G8B8 && format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE;
</span><span class="cx"> if (directToPixels)
</span><span class="lines">@@ -2802,18 +3169,17 @@
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
</span><del>- surface->Release();
</del><ins>+ SafeRelease(surface);
</ins><span class="cx"> return gl::error(GL_OUT_OF_MEMORY);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> result = mDevice->GetRenderTargetData(surface, systemSurface);
</span><del>- surface->Release();
- surface = NULL;
</del><ins>+ SafeRelease(surface);
</ins><span class="cx">
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><del>- systemSurface->Release();
</del><ins>+ SafeRelease(systemSurface);
</ins><span class="cx">
</span><span class="cx"> // It turns out that D3D will sometimes produce more error
</span><span class="cx"> // codes than those documented.
</span><span class="lines">@@ -2832,7 +3198,7 @@
</span><span class="cx">
</span><span class="cx"> if (directToPixels)
</span><span class="cx"> {
</span><del>- systemSurface->Release();
</del><ins>+ SafeRelease(systemSurface);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2848,17 +3214,14 @@
</span><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> UNREACHABLE();
</span><del>- systemSurface->Release();
</del><ins>+ SafeRelease(systemSurface);
</ins><span class="cx">
</span><span class="cx"> return; // No sensible error to generate
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned char *dest = (unsigned char*)pixels;
- unsigned short *dest16 = (unsigned short*)pixels;
-
</del><span class="cx"> unsigned char *source;
</span><span class="cx"> int inputPitch;
</span><del>- if (packReverseRowOrder)
</del><ins>+ if (pack.reverseRowOrder)
</ins><span class="cx"> {
</span><span class="cx"> source = ((unsigned char*)lock.pBits) + lock.Pitch * (rect.bottom - rect.top - 1);
</span><span class="cx"> inputPitch = -lock.Pitch;
</span><span class="lines">@@ -2869,231 +3232,69 @@
</span><span class="cx"> inputPitch = lock.Pitch;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned int fastPixelSize = 0;
</del><ins>+ GLuint clientVersion = getCurrentClientVersion();
</ins><span class="cx">
</span><del>- if (desc.Format == D3DFMT_A8R8G8B8 &&
- format == GL_BGRA_EXT &&
- type == GL_UNSIGNED_BYTE)
- {
- fastPixelSize = 4;
- }
- else if ((desc.Format == D3DFMT_A4R4G4B4 &&
- format == GL_BGRA_EXT &&
- type == GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT) ||
- (desc.Format == D3DFMT_A1R5G5B5 &&
- format == GL_BGRA_EXT &&
- type == GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT))
- {
- fastPixelSize = 2;
- }
- else if (desc.Format == D3DFMT_A16B16G16R16F &&
- format == GL_RGBA &&
- type == GL_HALF_FLOAT_OES)
- {
- fastPixelSize = 8;
- }
- else if (desc.Format == D3DFMT_A32B32G32R32F &&
- format == GL_RGBA &&
- type == GL_FLOAT)
- {
- fastPixelSize = 16;
- }
</del><ins>+ GLenum sourceInternalFormat = d3d9_gl::GetInternalFormat(desc.Format);
+ GLenum sourceFormat = gl::GetFormat(sourceInternalFormat, clientVersion);
+ GLenum sourceType = gl::GetType(sourceInternalFormat, clientVersion);
</ins><span class="cx">
</span><del>- for (int j = 0; j < rect.bottom - rect.top; j++)
</del><ins>+ GLuint sourcePixelSize = gl::GetPixelBytes(sourceInternalFormat, clientVersion);
+
+ if (sourceFormat == format && sourceType == type)
</ins><span class="cx"> {
</span><del>- if (fastPixelSize != 0)
</del><ins>+ // Direct copy possible
+ unsigned char *dest = static_cast<unsigned char*>(pixels);
+ for (int y = 0; y < rect.bottom - rect.top; y++)
</ins><span class="cx"> {
</span><del>- // Fast path for formats which require no translation:
- // D3DFMT_A8R8G8B8 to BGRA/UNSIGNED_BYTE
- // D3DFMT_A4R4G4B4 to BGRA/UNSIGNED_SHORT_4_4_4_4_REV_EXT
- // D3DFMT_A1R5G5B5 to BGRA/UNSIGNED_SHORT_1_5_5_5_REV_EXT
- // D3DFMT_A16B16G16R16F to RGBA/HALF_FLOAT_OES
- // D3DFMT_A32B32G32R32F to RGBA/FLOAT
- //
- // Note that buffers with no alpha go through the slow path below.
- memcpy(dest + j * outputPitch,
- source + j * inputPitch,
- (rect.right - rect.left) * fastPixelSize);
- continue;
</del><ins>+ memcpy(dest + y * outputPitch, source + y * inputPitch, (rect.right - rect.left) * sourcePixelSize);
</ins><span class="cx"> }
</span><del>- else if (desc.Format == D3DFMT_A8R8G8B8 &&
- format == GL_RGBA &&
- type == GL_UNSIGNED_BYTE)
- {
- // Fast path for swapping red with blue
- for (int i = 0; i < rect.right - rect.left; i++)
- {
- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
- *(unsigned int*)(dest + 4 * i + j * outputPitch) =
- (argb & 0xFF00FF00) | // Keep alpha and green
- (argb & 0x00FF0000) >> 16 | // Move red to blue
- (argb & 0x000000FF) << 16; // Move blue to red
- }
- continue;
- }
</del><ins>+ }
+ else
+ {
+ GLenum destInternalFormat = gl::GetSizedInternalFormat(format, type, clientVersion);
+ GLuint destPixelSize = gl::GetPixelBytes(destInternalFormat, clientVersion);
+ GLuint sourcePixelSize = gl::GetPixelBytes(sourceInternalFormat, clientVersion);
</ins><span class="cx">
</span><del>- for (int i = 0; i < rect.right - rect.left; i++)
</del><ins>+ ColorCopyFunction fastCopyFunc = d3d9::GetFastCopyFunction(desc.Format, format, type, getCurrentClientVersion());
+ if (fastCopyFunc)
</ins><span class="cx"> {
</span><del>- float r;
- float g;
- float b;
- float a;
-
- switch (desc.Format)
</del><ins>+ // Fast copy is possible through some special function
+ for (int y = 0; y < rect.bottom - rect.top; y++)
</ins><span class="cx"> {
</span><del>- case D3DFMT_R5G6B5:
</del><ins>+ for (int x = 0; x < rect.right - rect.left; x++)
</ins><span class="cx"> {
</span><del>- unsigned short rgb = *(unsigned short*)(source + 2 * i + j * inputPitch);
</del><ins>+ void *dest = static_cast<unsigned char*>(pixels) + y * outputPitch + x * destPixelSize;
+ void *src = static_cast<unsigned char*>(source) + y * inputPitch + x * sourcePixelSize;
</ins><span class="cx">
</span><del>- a = 1.0f;
- b = (rgb & 0x001F) * (1.0f / 0x001F);
- g = (rgb & 0x07E0) * (1.0f / 0x07E0);
- r = (rgb & 0xF800) * (1.0f / 0xF800);
</del><ins>+ fastCopyFunc(src, dest);
</ins><span class="cx"> }
</span><del>- break;
- case D3DFMT_A1R5G5B5:
- {
- unsigned short argb = *(unsigned short*)(source + 2 * i + j * inputPitch);
</del><ins>+ }
+ }
+ else
+ {
+ ColorReadFunction readFunc = d3d9::GetColorReadFunction(desc.Format);
+ ColorWriteFunction writeFunc = gl::GetColorWriteFunction(format, type, clientVersion);
</ins><span class="cx">
</span><del>- a = (argb & 0x8000) ? 1.0f : 0.0f;
- b = (argb & 0x001F) * (1.0f / 0x001F);
- g = (argb & 0x03E0) * (1.0f / 0x03E0);
- r = (argb & 0x7C00) * (1.0f / 0x7C00);
- }
- break;
- case D3DFMT_A8R8G8B8:
- {
- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
</del><ins>+ gl::ColorF temp;
</ins><span class="cx">
</span><del>- a = (argb & 0xFF000000) * (1.0f / 0xFF000000);
- b = (argb & 0x000000FF) * (1.0f / 0x000000FF);
- g = (argb & 0x0000FF00) * (1.0f / 0x0000FF00);
- r = (argb & 0x00FF0000) * (1.0f / 0x00FF0000);
- }
- break;
- case D3DFMT_X8R8G8B8:
</del><ins>+ for (int y = 0; y < rect.bottom - rect.top; y++)
+ {
+ for (int x = 0; x < rect.right - rect.left; x++)
</ins><span class="cx"> {
</span><del>- unsigned int xrgb = *(unsigned int*)(source + 4 * i + j * inputPitch);
</del><ins>+ void *dest = reinterpret_cast<unsigned char*>(pixels) + y * outputPitch + x * destPixelSize;
+ void *src = source + y * inputPitch + x * sourcePixelSize;
</ins><span class="cx">
</span><del>- a = 1.0f;
- b = (xrgb & 0x000000FF) * (1.0f / 0x000000FF);
- g = (xrgb & 0x0000FF00) * (1.0f / 0x0000FF00);
- r = (xrgb & 0x00FF0000) * (1.0f / 0x00FF0000);
</del><ins>+ // readFunc and writeFunc will be using the same type of color, CopyTexImage
+ // will not allow the copy otherwise.
+ readFunc(src, &temp);
+ writeFunc(&temp, dest);
</ins><span class="cx"> }
</span><del>- break;
- case D3DFMT_A2R10G10B10:
- {
- unsigned int argb = *(unsigned int*)(source + 4 * i + j * inputPitch);
-
- a = (argb & 0xC0000000) * (1.0f / 0xC0000000);
- b = (argb & 0x000003FF) * (1.0f / 0x000003FF);
- g = (argb & 0x000FFC00) * (1.0f / 0x000FFC00);
- r = (argb & 0x3FF00000) * (1.0f / 0x3FF00000);
- }
- break;
- case D3DFMT_A32B32G32R32F:
- {
- // float formats in D3D are stored rgba, rather than the other way round
- r = *((float*)(source + 16 * i + j * inputPitch) + 0);
- g = *((float*)(source + 16 * i + j * inputPitch) + 1);
- b = *((float*)(source + 16 * i + j * inputPitch) + 2);
- a = *((float*)(source + 16 * i + j * inputPitch) + 3);
- }
- break;
- case D3DFMT_A16B16G16R16F:
- {
- // float formats in D3D are stored rgba, rather than the other way round
- r = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 0));
- g = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 1));
- b = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 2));
- a = gl::float16ToFloat32(*((unsigned short*)(source + 8 * i + j * inputPitch) + 3));
- }
- break;
- default:
- UNIMPLEMENTED(); // FIXME
- UNREACHABLE();
- return;
</del><span class="cx"> }
</span><del>-
- switch (format)
- {
- case GL_RGBA:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * r + 0.5f);
- dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
- dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * b + 0.5f);
- dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
- break;
- default: UNREACHABLE();
- }
- break;
- case GL_BGRA_EXT:
- switch (type)
- {
- case GL_UNSIGNED_BYTE:
- dest[4 * i + j * outputPitch + 0] = (unsigned char)(255 * b + 0.5f);
- dest[4 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
- dest[4 * i + j * outputPitch + 2] = (unsigned char)(255 * r + 0.5f);
- dest[4 * i + j * outputPitch + 3] = (unsigned char)(255 * a + 0.5f);
- break;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- dest16[i + j * outputPitch / sizeof(unsigned short)] =
- ((unsigned short)(15 * a + 0.5f) << 12)|
- ((unsigned short)(15 * r + 0.5f) << 8) |
- ((unsigned short)(15 * g + 0.5f) << 4) |
- ((unsigned short)(15 * b + 0.5f) << 0);
- break;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
- // According to the desktop GL spec in the "Transfer of Pixel Rectangles" section
- // this type is packed as follows:
- // 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- // --------------------------------------------------------------------------------
- // | 4th | 3rd | 2nd | 1st component |
- // --------------------------------------------------------------------------------
- // in the case of BGRA_EXT, B is the first component, G the second, and so forth.
- dest16[i + j * outputPitch / sizeof(unsigned short)] =
- ((unsigned short)( a + 0.5f) << 15) |
- ((unsigned short)(31 * r + 0.5f) << 10) |
- ((unsigned short)(31 * g + 0.5f) << 5) |
- ((unsigned short)(31 * b + 0.5f) << 0);
- break;
- default: UNREACHABLE();
- }
- break;
- case GL_RGB:
- switch (type)
- {
- case GL_UNSIGNED_SHORT_5_6_5:
- dest16[i + j * outputPitch / sizeof(unsigned short)] =
- ((unsigned short)(31 * b + 0.5f) << 0) |
- ((unsigned short)(63 * g + 0.5f) << 5) |
- ((unsigned short)(31 * r + 0.5f) << 11);
- break;
- case GL_UNSIGNED_BYTE:
- dest[3 * i + j * outputPitch + 0] = (unsigned char)(255 * r + 0.5f);
- dest[3 * i + j * outputPitch + 1] = (unsigned char)(255 * g + 0.5f);
- dest[3 * i + j * outputPitch + 2] = (unsigned char)(255 * b + 0.5f);
- break;
- default: UNREACHABLE();
- }
- break;
- default: UNREACHABLE();
- }
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> systemSurface->UnlockRect();
</span><del>-
- systemSurface->Release();
</del><ins>+ SafeRelease(systemSurface);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderTarget *Renderer9::createRenderTarget(SwapChain *swapChain, bool depth)
</span><span class="lines">@@ -3114,14 +3315,19 @@
</span><span class="cx"> return renderTarget;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget *Renderer9::createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth)
</del><ins>+RenderTarget *Renderer9::createRenderTarget(int width, int height, GLenum format, GLsizei samples)
</ins><span class="cx"> {
</span><span class="cx"> RenderTarget9 *renderTarget = new RenderTarget9(this, width, height, format, samples);
</span><span class="cx"> return renderTarget;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length, rx::ShaderType type)
</del><ins>+ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers)
</ins><span class="cx"> {
</span><ins>+ // Transform feedback is not supported in ES2 or D3D9
+ ASSERT(transformFeedbackVaryings.size() == 0);
+
</ins><span class="cx"> ShaderExecutable9 *executable = NULL;
</span><span class="cx">
</span><span class="cx"> switch (type)
</span><span class="lines">@@ -3152,8 +3358,13 @@
</span><span class="cx"> return executable;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround)
</del><ins>+ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround)
</ins><span class="cx"> {
</span><ins>+ // Transform feedback is not supported in ES2 or D3D9
+ ASSERT(transformFeedbackVaryings.size() == 0);
+
</ins><span class="cx"> const char *profile = NULL;
</span><span class="cx">
</span><span class="cx"> switch (type)
</span><span class="lines">@@ -3169,20 +3380,36 @@
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // ANGLE issue 486:
- // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by disabling optimization
- UINT optimizationFlags = (workaround == ANGLE_D3D_WORKAROUND_SM3_OPTIMIZER ? D3DCOMPILE_SKIP_OPTIMIZATION : ANGLE_COMPILE_OPTIMIZATION_LEVEL);
</del><ins>+ UINT optimizationFlags = ANGLE_COMPILE_OPTIMIZATION_LEVEL;
</ins><span class="cx">
</span><del>- ID3DBlob *binary = (ID3DBlob*)compileToBinary(infoLog, shaderHLSL, profile, optimizationFlags, true);
</del><ins>+ if (workaround == ANGLE_D3D_WORKAROUND_SKIP_OPTIMIZATION)
+ {
+ optimizationFlags = D3DCOMPILE_SKIP_OPTIMIZATION;
+ }
+ else if (workaround == ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION)
+ {
+ optimizationFlags = D3DCOMPILE_OPTIMIZATION_LEVEL3;
+ }
+ else ASSERT(workaround == ANGLE_D3D_WORKAROUND_NONE);
+
+ ID3DBlob *binary = (ID3DBlob*)mCompiler.compileToBinary(infoLog, shaderHLSL, profile, optimizationFlags, true);
</ins><span class="cx"> if (!binary)
</span><ins>+ {
</ins><span class="cx"> return NULL;
</span><ins>+ }
</ins><span class="cx">
</span><del>- ShaderExecutable *executable = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type);
- binary->Release();
</del><ins>+ ShaderExecutable *executable = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type,
+ transformFeedbackVaryings, separatedOutputBuffers);
+ SafeRelease(binary);
</ins><span class="cx">
</span><span class="cx"> return executable;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+rx::UniformStorage *Renderer9::createUniformStorage(size_t storageSize)
+{
+ return new UniformStorage(storageSize);
+}
+
</ins><span class="cx"> bool Renderer9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
</span><span class="cx"> {
</span><span class="cx"> return mBlit->boxFilter(source, dest);
</span><span class="lines">@@ -3223,7 +3450,7 @@
</span><span class="cx"> {
</span><span class="cx"> Image9::copyLockableSurfaces(surf, source);
</span><span class="cx"> result = mDevice->UpdateSurface(surf, NULL, dest, NULL);
</span><del>- surf->Release();
</del><ins>+ SafeRelease(surf);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="lines">@@ -3260,16 +3487,32 @@
</span><span class="cx"> return new TextureStorage9_2D(this, swapChain9);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage *Renderer9::createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
</del><ins>+TextureStorage *Renderer9::createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
</ins><span class="cx"> {
</span><del>- return new TextureStorage9_2D(this, levels, internalformat, usage, forceRenderable, width, height);
</del><ins>+ return new TextureStorage9_2D(this, internalformat, renderTarget, width, height, levels);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage *Renderer9::createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
</del><ins>+TextureStorage *Renderer9::createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels)
</ins><span class="cx"> {
</span><del>- return new TextureStorage9_Cube(this, levels, internalformat, usage, forceRenderable, size);
</del><ins>+ return new TextureStorage9_Cube(this, internalformat, renderTarget, size, levels);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
</ins><span class="cx"> bool Renderer9::getLUID(LUID *adapterLuid) const
</span><span class="cx"> {
</span><span class="cx"> adapterLuid->HighPart = 0;
</span><span class="lines">@@ -3284,4 +3527,20 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+GLenum Renderer9::getNativeTextureFormat(GLenum internalFormat) const
+{
+ return d3d9_gl::GetInternalFormat(gl_d3d9::GetTextureFormat(internalFormat, this));
</ins><span class="cx"> }
</span><ins>+
+rx::VertexConversionType Renderer9::getVertexConversionType(const gl::VertexFormat &vertexFormat) const
+{
+ return d3d9::GetVertexConversionType(vertexFormat);
+}
+
+GLenum Renderer9::getVertexComponentType(const gl::VertexFormat &vertexFormat) const
+{
+ D3DDECLTYPE declType = d3d9::GetNativeVertexFormat(vertexFormat);
+ return d3d9::GetDeclTypeComponentType(declType);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9Renderer9h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/Renderer9.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-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">@@ -10,8 +10,9 @@
</span><span class="cx"> #define LIBGLESV2_RENDERER_RENDERER9_H_
</span><span class="cx">
</span><span class="cx"> #include "common/angleutils.h"
</span><del>-#include "libGLESv2/mathutil.h"
-#include "libGLESv2/renderer/ShaderCache.h"
</del><ins>+#include "common/mathutil.h"
+#include "libGLESv2/renderer/d3d/HLSLCompiler.h"
+#include "libGLESv2/renderer/d3d9/ShaderCache.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
</span><span class="cx"> #include "libGLESv2/renderer/Renderer.h"
</span><span class="cx"> #include "libGLESv2/renderer/RenderTarget.h"
</span><span class="lines">@@ -27,6 +28,7 @@
</span><span class="cx"> class IndexDataManager;
</span><span class="cx"> class StreamingIndexBufferInterface;
</span><span class="cx"> struct TranslatedAttribute;
</span><ins>+class Blit9;
</ins><span class="cx">
</span><span class="cx"> class Renderer9 : public Renderer
</span><span class="cx"> {
</span><span class="lines">@@ -57,22 +59,14 @@
</span><span class="cx"> IDirect3DPixelShader9 *createPixelShader(const DWORD *function, size_t length);
</span><span class="cx"> HRESULT createVertexBuffer(UINT Length, DWORD Usage, IDirect3DVertexBuffer9 **ppVertexBuffer);
</span><span class="cx"> HRESULT createIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, IDirect3DIndexBuffer9 **ppIndexBuffer);
</span><del>-#if 0
- void *createTexture2D();
- void *createTextureCube();
- void *createQuery();
- void *createIndexBuffer();
- void *createVertexbuffer();
-
- // state setup
- void applyShaders();
- void applyConstants();
-#endif
</del><ins>+ virtual void generateSwizzle(gl::Texture *texture);
</ins><span class="cx"> virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler);
</span><span class="cx"> virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture);
</span><span class="cx">
</span><ins>+ virtual bool setUniformBuffers(const gl::Buffer *vertexUniformBuffers[], const gl::Buffer *fragmentUniformBuffers[]);
+
</ins><span class="cx"> virtual void setRasterizerState(const gl::RasterizerState &rasterState);
</span><del>- virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::Color &blendColor,
</del><ins>+ virtual void setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState &blendState, const gl::ColorF &blendColor,
</ins><span class="cx"> unsigned int sampleMask);
</span><span class="cx"> virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef,
</span><span class="cx"> int stencilBackRef, bool frontFaceCCW);
</span><span class="lines">@@ -82,15 +76,19 @@
</span><span class="cx"> bool ignoreViewport);
</span><span class="cx">
</span><span class="cx"> virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
</span><del>- virtual void applyShaders(gl::ProgramBinary *programBinary);
- virtual void applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray);
</del><ins>+ virtual void applyShaders(gl::ProgramBinary *programBinary, bool rasterizerDiscard, bool transformFeedbackActive, const gl::VertexFormat inputLayout[]);
+ virtual void applyUniforms(const gl::ProgramBinary &programBinary);
</ins><span class="cx"> virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
</span><del>- virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
</del><ins>+ virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], gl::VertexAttribCurrentValueData currentValues[],
+ GLint first, GLsizei count, GLsizei instances);
</ins><span class="cx"> virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
</span><span class="cx">
</span><del>- virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
- virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
</del><ins>+ virtual void applyTransformFeedbackBuffers(gl::Buffer *transformFeedbackBuffers[], GLintptr offsets[]);
</ins><span class="cx">
</span><ins>+ virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances, bool transformFeedbackActive);
+ virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+ gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo, GLsizei instances);
+
</ins><span class="cx"> virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
</span><span class="cx">
</span><span class="cx"> virtual void markAllStateDirty();
</span><span class="lines">@@ -108,14 +106,20 @@
</span><span class="cx"> virtual GUID getAdapterIdentifier() const;
</span><span class="cx">
</span><span class="cx"> virtual bool getBGRATextureSupport() const;
</span><del>- virtual bool getDXT1TextureSupport();
- virtual bool getDXT3TextureSupport();
- virtual bool getDXT5TextureSupport();
- virtual bool getEventQuerySupport();
- virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable);
- virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable);
- virtual bool getLuminanceTextureSupport();
- virtual bool getLuminanceAlphaTextureSupport();
</del><ins>+ virtual bool getDXT1TextureSupport() const;
+ virtual bool getDXT3TextureSupport() const;
+ virtual bool getDXT5TextureSupport() const;
+ virtual bool getEventQuerySupport() const;
+ virtual bool getFloat32TextureSupport() const;
+ virtual bool getFloat32TextureFilteringSupport() const;
+ virtual bool getFloat32TextureRenderingSupport() const;
+ virtual bool getFloat16TextureSupport() const;
+ virtual bool getFloat16TextureFilteringSupport() const;
+ virtual bool getFloat16TextureRenderingSupport() const;
+ virtual bool getRGB565TextureSupport() const;
+ virtual bool getLuminanceTextureSupport() const;
+ virtual bool getLuminanceAlphaTextureSupport() const;
+ virtual bool getRGTextureSupport() const;
</ins><span class="cx"> virtual unsigned int getMaxVertexTextureImageUnits() const;
</span><span class="cx"> virtual unsigned int getMaxCombinedTextureImageUnits() const;
</span><span class="cx"> virtual unsigned int getReservedVertexUniformVectors() const;
</span><span class="lines">@@ -123,61 +127,90 @@
</span><span class="cx"> virtual unsigned int getMaxVertexUniformVectors() const;
</span><span class="cx"> virtual unsigned int getMaxFragmentUniformVectors() const;
</span><span class="cx"> virtual unsigned int getMaxVaryingVectors() const;
</span><ins>+ virtual unsigned int getMaxVertexShaderUniformBuffers() const;
+ virtual unsigned int getMaxFragmentShaderUniformBuffers() const;
+ virtual unsigned int getReservedVertexUniformBuffers() const;
+ virtual unsigned int getReservedFragmentUniformBuffers() const;
+ virtual unsigned int getMaxTransformFeedbackBuffers() const;
+ virtual unsigned int getMaxTransformFeedbackSeparateComponents() const;
+ virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const;
+ virtual unsigned int getMaxUniformBufferSize() const;
</ins><span class="cx"> virtual bool getNonPower2TextureSupport() const;
</span><span class="cx"> virtual bool getDepthTextureSupport() const;
</span><span class="cx"> virtual bool getOcclusionQuerySupport() const;
</span><span class="cx"> virtual bool getInstancingSupport() const;
</span><span class="cx"> virtual bool getTextureFilterAnisotropySupport() const;
</span><ins>+ virtual bool getPBOSupport() const;
</ins><span class="cx"> virtual float getTextureMaxAnisotropy() const;
</span><span class="cx"> virtual bool getShareHandleSupport() const;
</span><span class="cx"> virtual bool getDerivativeInstructionSupport() const;
</span><span class="cx"> virtual bool getPostSubBufferSupport() const;
</span><ins>+ virtual int getMaxRecommendedElementsIndices() const;
+ virtual int getMaxRecommendedElementsVertices() const;
</ins><span class="cx">
</span><span class="cx"> virtual int getMajorShaderModel() const;
</span><span class="cx"> virtual float getMaxPointSize() const;
</span><span class="cx"> virtual int getMaxViewportDimension() const;
</span><span class="cx"> virtual int getMaxTextureWidth() const;
</span><span class="cx"> virtual int getMaxTextureHeight() const;
</span><ins>+ virtual int getMaxTextureDepth() const;
+ virtual int getMaxTextureArrayLayers() const;
</ins><span class="cx"> virtual bool get32BitIndexSupport() const;
</span><span class="cx"> DWORD getCapsDeclTypes() const;
</span><span class="cx"> virtual int getMinSwapInterval() const;
</span><span class="cx"> virtual int getMaxSwapInterval() const;
</span><span class="cx">
</span><span class="cx"> virtual GLsizei getMaxSupportedSamples() const;
</span><ins>+ virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+ virtual GLsizei getNumSampleCounts(GLenum internalFormat) const;
+ virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
</ins><span class="cx"> int getNearestSupportedSamples(D3DFORMAT format, int requested) const;
</span><span class="cx">
</span><span class="cx"> virtual unsigned int getMaxRenderTargets() const;
</span><span class="cx">
</span><del>- D3DFORMAT ConvertTextureInternalFormat(GLint internalformat);
</del><ins>+ D3DFORMAT ConvertTextureInternalFormat(GLenum internalformat);
</ins><span class="cx">
</span><span class="cx"> // Pixel operations
</span><span class="cx"> virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source);
</span><span class="cx"> virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source);
</span><ins>+ virtual bool copyToRenderTarget(TextureStorageInterface3D *dest, TextureStorageInterface3D *source);
+ virtual bool copyToRenderTarget(TextureStorageInterface2DArray *dest, TextureStorageInterface2DArray *source);
</ins><span class="cx">
</span><span class="cx"> virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
</span><span class="cx"> GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level);
</span><span class="cx"> virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
</span><span class="cx"> GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level);
</span><ins>+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level);
+ virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level);
</ins><span class="cx">
</span><span class="cx"> virtual bool blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &readRect, gl::Framebuffer *drawTarget, const gl::Rectangle &drawRect,
</span><del>- bool blitRenderTarget, bool blitDepthStencil);
- virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels);
</del><ins>+ const gl::Rectangle *scissor, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter);
+ virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, GLuint outputPitch, const gl::PixelPackState &pack, void* pixels);
</ins><span class="cx">
</span><span class="cx"> // RenderTarget creation
</span><span class="cx"> virtual RenderTarget *createRenderTarget(SwapChain *swapChain, bool depth);
</span><del>- virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth);
</del><ins>+ virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples);
</ins><span class="cx">
</span><span class="cx"> // Shader operations
</span><del>- virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type);
- virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type, D3DWorkaroundType workaround);
</del><ins>+ virtual ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers);
+ virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, rx::ShaderType type,
+ const std::vector<gl::LinkedVarying> &transformFeedbackVaryings,
+ bool separatedOutputBuffers, D3DWorkaroundType workaround);
+ virtual UniformStorage *createUniformStorage(size_t storageSize);
</ins><span class="cx">
</span><span class="cx"> // Image operations
</span><span class="cx"> virtual Image *createImage();
</span><span class="cx"> virtual void generateMipmap(Image *dest, Image *source);
</span><span class="cx"> virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain);
</span><del>- virtual TextureStorage *createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
- virtual TextureStorage *createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
</del><ins>+ virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
+ virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels);
+ 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);
</ins><span class="cx">
</span><span class="cx"> // Buffer creation
</span><span class="cx"> virtual VertexBuffer *createVertexBuffer();
</span><span class="lines">@@ -188,26 +221,33 @@
</span><span class="cx"> virtual QueryImpl *createQuery(GLenum type);
</span><span class="cx"> virtual FenceImpl *createFence();
</span><span class="cx">
</span><ins>+ // Buffer-to-texture and Texture-to-buffer copies
+ virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
+ virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
+
</ins><span class="cx"> // D3D9-renderer specific methods
</span><span class="cx"> bool boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
</span><span class="cx">
</span><span class="cx"> D3DPOOL getTexturePool(DWORD usage) const;
</span><span class="cx">
</span><span class="cx"> virtual bool getLUID(LUID *adapterLuid) const;
</span><ins>+ virtual GLenum getNativeTextureFormat(GLenum internalFormat) const;
+ virtual rx::VertexConversionType getVertexConversionType(const gl::VertexFormat &vertexFormat) const;
+ virtual GLenum getVertexComponentType(const gl::VertexFormat &vertexFormat) const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(Renderer9);
</span><span class="cx">
</span><span class="cx"> void deinitialize();
</span><span class="cx">
</span><del>- void applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v);
- void applyUniformniv(gl::Uniform *targetUniform, const GLint *v);
- void applyUniformnbv(gl::Uniform *targetUniform, const GLint *v);
</del><ins>+ void applyUniformnfv(gl::LinkedUniform *targetUniform, const GLfloat *v);
+ void applyUniformniv(gl::LinkedUniform *targetUniform, const GLint *v);
+ void applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v);
</ins><span class="cx">
</span><span class="cx"> void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
</span><span class="cx"> void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
</span><span class="cx">
</span><del>- void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
</del><span class="cx"> bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
</span><span class="cx"> gl::Renderbuffer *getNullColorbuffer(gl::Renderbuffer *depthbuffer);
</span><span class="cx">
</span><span class="lines">@@ -232,8 +272,10 @@
</span><span class="cx"> IDirect3DDevice9 *mDevice;
</span><span class="cx"> IDirect3DDevice9Ex *mDeviceEx; // Might be null if D3D9Ex is not supported.
</span><span class="cx">
</span><del>- Blit *mBlit;
</del><ins>+ HLSLCompiler mCompiler;
</ins><span class="cx">
</span><ins>+ Blit9 *mBlit;
+
</ins><span class="cx"> HWND mDeviceWindow;
</span><span class="cx">
</span><span class="cx"> bool mDeviceLost;
</span><span class="lines">@@ -256,6 +298,8 @@
</span><span class="cx">
</span><span class="cx"> bool mDepthTextureSupport;
</span><span class="cx">
</span><ins>+ bool mRGB565TextureSupport;
+
</ins><span class="cx"> bool mFloat32TextureSupport;
</span><span class="cx"> bool mFloat32FilterSupport;
</span><span class="cx"> bool mFloat32RenderSupport;
</span><span class="lines">@@ -271,9 +315,19 @@
</span><span class="cx"> bool mLuminanceTextureSupport;
</span><span class="cx"> bool mLuminanceAlphaTextureSupport;
</span><span class="cx">
</span><del>- std::map<D3DFORMAT, bool *> mMultiSampleSupport;
- GLsizei mMaxSupportedSamples;
</del><ins>+ bool mRGTextureSupport;
</ins><span class="cx">
</span><ins>+ struct MultisampleSupportInfo
+ {
+ bool supportedSamples[D3DMULTISAMPLE_16_SAMPLES + 1];
+ unsigned int maxSupportedSamples;
+ };
+ typedef std::map<D3DFORMAT, MultisampleSupportInfo> MultisampleSupportMap;
+ MultisampleSupportMap mMultiSampleSupport;
+ unsigned int mMaxSupportedSamples;
+
+ MultisampleSupportInfo getMultiSampleSupport(D3DFORMAT format);
+
</ins><span class="cx"> // current render target states
</span><span class="cx"> unsigned int mAppliedRenderTargetSerial;
</span><span class="cx"> unsigned int mAppliedDepthbufferSerial;
</span><span class="lines">@@ -308,7 +362,7 @@
</span><span class="cx">
</span><span class="cx"> bool mForceSetBlendState;
</span><span class="cx"> gl::BlendState mCurBlendState;
</span><del>- gl::Color mCurBlendColor;
</del><ins>+ gl::ColorF mCurBlendColor;
</ins><span class="cx"> GLuint mCurSampleMask;
</span><span class="cx">
</span><span class="cx"> // Currently applied sampler states
</span><span class="lines">@@ -323,7 +377,8 @@
</span><span class="cx"> unsigned int mCurPixelTextureSerials[gl::MAX_TEXTURE_IMAGE_UNITS];
</span><span class="cx">
</span><span class="cx"> unsigned int mAppliedIBSerial;
</span><del>- unsigned int mAppliedProgramBinarySerial;
</del><ins>+ IDirect3DVertexShader9 *mAppliedVertexShader;
+ IDirect3DPixelShader9 *mAppliedPixelShader;
</ins><span class="cx">
</span><span class="cx"> rx::dx_VertexConstants mVertexConstants;
</span><span class="cx"> rx::dx_PixelConstants mPixelConstants;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9ShaderExecutable9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/ShaderExecutable9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -31,14 +31,8 @@
</span><span class="cx">
</span><span class="cx"> ShaderExecutable9::~ShaderExecutable9()
</span><span class="cx"> {
</span><del>- if (mVertexExecutable)
- {
- mVertexExecutable->Release();
- }
- if (mPixelExecutable)
- {
- mPixelExecutable->Release();
- }
</del><ins>+ SafeRelease(mVertexExecutable);
+ SafeRelease(mPixelExecutable);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ShaderExecutable9 *ShaderExecutable9::makeShaderExecutable9(ShaderExecutable *executable)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9SwapChain9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/SwapChain9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/SwapChain9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/SwapChain9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -9,6 +9,7 @@
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/SwapChain9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/renderer9_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d9/formatutils9.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d9/Renderer9.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="lines">@@ -35,38 +36,16 @@
</span><span class="cx">
</span><span class="cx"> void SwapChain9::release()
</span><span class="cx"> {
</span><del>- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
</del><ins>+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBuffer);
+ SafeRelease(mDepthStencil);
+ SafeRelease(mRenderTarget);
+ SafeRelease(mOffscreenTexture);
</ins><span class="cx">
</span><del>- if (mBackBuffer)
- {
- mBackBuffer->Release();
- mBackBuffer = NULL;
- }
-
- if (mDepthStencil)
- {
- mDepthStencil->Release();
- mDepthStencil = NULL;
- }
-
- if (mRenderTarget)
- {
- mRenderTarget->Release();
- mRenderTarget = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
</del><span class="cx"> if (mWindow)
</span><ins>+ {
</ins><span class="cx"> mShareHandle = NULL;
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static DWORD convertInterval(EGLint interval)
</span><span class="lines">@@ -111,30 +90,11 @@
</span><span class="cx">
</span><span class="cx"> // Release specific resources to free up memory for the new render target, while the
</span><span class="cx"> // old render target still exists for the purpose of preserving its contents.
</span><del>- if (mSwapChain)
- {
- mSwapChain->Release();
- mSwapChain = NULL;
- }
</del><ins>+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBuffer);
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mDepthStencil);
</ins><span class="cx">
</span><del>- if (mBackBuffer)
- {
- mBackBuffer->Release();
- mBackBuffer = NULL;
- }
-
- if (mOffscreenTexture)
- {
- mOffscreenTexture->Release();
- mOffscreenTexture = NULL;
- }
-
- if (mDepthStencil)
- {
- mDepthStencil->Release();
- mDepthStencil = NULL;
- }
-
</del><span class="cx"> HANDLE *pShareHandle = NULL;
</span><span class="cx"> if (!mWindow && mRenderer->getShareHandleSupport())
</span><span class="cx"> {
</span><span class="lines">@@ -142,8 +102,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
</span><del>- gl_d3d9::ConvertRenderbufferFormat(mBackBufferFormat), D3DPOOL_DEFAULT,
- &mOffscreenTexture, pShareHandle);
</del><ins>+ gl_d3d9::GetTextureFormat(mBackBufferFormat, mRenderer),
+ D3DPOOL_DEFAULT, &mOffscreenTexture, pShareHandle);
</ins><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ERR("Could not create offscreen texture: %08lX", result);
</span><span class="lines">@@ -187,15 +147,15 @@
</span><span class="cx"> result = device->StretchRect(oldRenderTarget, &rect, mRenderTarget, &rect, D3DTEXF_NONE);
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><del>- oldRenderTarget->Release();
</del><ins>+ SafeRelease(oldRenderTarget);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (mWindow)
</span><span class="cx"> {
</span><span class="cx"> D3DPRESENT_PARAMETERS presentParameters = {0};
</span><del>- presentParameters.AutoDepthStencilFormat = gl_d3d9::ConvertRenderbufferFormat(mDepthBufferFormat);
</del><ins>+ presentParameters.AutoDepthStencilFormat = gl_d3d9::GetRenderFormat(mDepthBufferFormat, mRenderer);
</ins><span class="cx"> presentParameters.BackBufferCount = 1;
</span><del>- presentParameters.BackBufferFormat = gl_d3d9::ConvertRenderbufferFormat(mBackBufferFormat);
</del><ins>+ presentParameters.BackBufferFormat = gl_d3d9::GetRenderFormat(mBackBufferFormat, mRenderer);
</ins><span class="cx"> presentParameters.EnableAutoDepthStencil = FALSE;
</span><span class="cx"> presentParameters.Flags = 0;
</span><span class="cx"> presentParameters.hDeviceWindow = mWindow;
</span><span class="lines">@@ -247,7 +207,7 @@
</span><span class="cx"> if (mDepthBufferFormat != GL_NONE)
</span><span class="cx"> {
</span><span class="cx"> result = device->CreateDepthStencilSurface(backbufferWidth, backbufferHeight,
</span><del>- gl_d3d9::ConvertRenderbufferFormat(mDepthBufferFormat),
</del><ins>+ gl_d3d9::GetRenderFormat(mDepthBufferFormat, mRenderer),
</ins><span class="cx"> D3DMULTISAMPLE_NONE, 0, FALSE, &mDepthStencil, NULL);
</span><span class="cx">
</span><span class="cx"> if (FAILED(result))
</span><span class="lines">@@ -356,6 +316,14 @@
</span><span class="cx"> return EGL_BAD_ALLOC;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // 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;
+ }
+
</ins><span class="cx"> // http://crbug.com/313210
</span><span class="cx"> // If our swap failed, trigger a device lost event. Resetting will work around an AMD-specific
</span><span class="cx"> // device removed bug with lost contexts when reinstalling drivers.
</span><span class="lines">@@ -370,6 +338,7 @@
</span><span class="cx">
</span><span class="cx"> // Increments refcount on surface.
</span><span class="cx"> // caller must Release() the returned surface
</span><ins>+// TODO: remove the AddRef to match SwapChain11
</ins><span class="cx"> IDirect3DSurface9 *SwapChain9::getRenderTarget()
</span><span class="cx"> {
</span><span class="cx"> if (mRenderTarget)
</span><span class="lines">@@ -382,6 +351,7 @@
</span><span class="cx">
</span><span class="cx"> // Increments refcount on surface.
</span><span class="cx"> // caller must Release() the returned surface
</span><ins>+// TODO: remove the AddRef to match SwapChain11
</ins><span class="cx"> IDirect3DSurface9 *SwapChain9::getDepthStencil()
</span><span class="cx"> {
</span><span class="cx"> if (mDepthStencil)
</span><span class="lines">@@ -394,6 +364,7 @@
</span><span class="cx">
</span><span class="cx"> // Increments refcount on texture.
</span><span class="cx"> // caller must Release() the returned texture
</span><ins>+// TODO: remove the AddRef to match SwapChain11
</ins><span class="cx"> IDirect3DTexture9 *SwapChain9::getOffscreenTexture()
</span><span class="cx"> {
</span><span class="cx"> if (mOffscreenTexture)
</span><span class="lines">@@ -434,10 +405,10 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- mSwapChain->Release();
</del><ins>+ SafeRelease(mSwapChain);
</ins><span class="cx"> mSwapChain = newSwapChain;
</span><span class="cx">
</span><del>- mBackBuffer->Release();
</del><ins>+ SafeRelease(mBackBuffer);
</ins><span class="cx"> result = mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
</span><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9TextureStorage9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #include "precompiled.h"
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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">@@ -15,12 +15,13 @@
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/SwapChain9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/RenderTarget9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/renderer9_utils.h"
</span><ins>+#include "libGLESv2/renderer/d3d9/formatutils9.h"
</ins><span class="cx"> #include "libGLESv2/Texture.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx"> TextureStorage9::TextureStorage9(Renderer *renderer, DWORD usage)
</span><del>- : mLodOffset(0),
</del><ins>+ : mTopLevel(0),
</ins><span class="cx"> mRenderer(Renderer9::makeRenderer9(renderer)),
</span><span class="cx"> mD3DUsage(usage),
</span><span class="cx"> mD3DPool(mRenderer->getTexturePool(usage))
</span><span class="lines">@@ -37,47 +38,26 @@
</span><span class="cx"> return static_cast<TextureStorage9*>(storage);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-DWORD TextureStorage9::GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable)
</del><ins>+DWORD TextureStorage9::GetTextureUsage(GLenum internalformat, Renderer9 *renderer, bool renderTarget)
</ins><span class="cx"> {
</span><ins>+ GLuint clientVersion = renderer->getCurrentClientVersion();
+
</ins><span class="cx"> DWORD d3dusage = 0;
</span><span class="cx">
</span><del>- if (d3dfmt == D3DFMT_INTZ)
</del><ins>+ if (gl::GetDepthBits(internalformat, clientVersion) > 0 ||
+ gl::GetStencilBits(internalformat, clientVersion) > 0)
</ins><span class="cx"> {
</span><span class="cx"> d3dusage |= D3DUSAGE_DEPTHSTENCIL;
</span><span class="cx"> }
</span><del>- else if(forceRenderable || (TextureStorage9::IsTextureFormatRenderable(d3dfmt) && (glusage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE)))
</del><ins>+ else if (renderTarget && (gl_d3d9::GetRenderFormat(internalformat, renderer) != D3DFMT_UNKNOWN))
</ins><span class="cx"> {
</span><span class="cx"> d3dusage |= D3DUSAGE_RENDERTARGET;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> return d3dusage;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool TextureStorage9::IsTextureFormatRenderable(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- {
- return true;
- }
- switch(format)
- {
- case D3DFMT_L8:
- case D3DFMT_A8L8:
- case D3DFMT_DXT1:
- case D3DFMT_DXT3:
- case D3DFMT_DXT5:
- return false;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_X8R8G8B8:
- case D3DFMT_A16B16G16R16F:
- case D3DFMT_A32B32G32R32F:
- return true;
- default:
- UNREACHABLE();
- }
</del><span class="cx">
</span><del>- return false;
-}
-
</del><span class="cx"> bool TextureStorage9::isRenderTarget() const
</span><span class="cx"> {
</span><span class="cx"> return (mD3DUsage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) != 0;
</span><span class="lines">@@ -98,17 +78,18 @@
</span><span class="cx"> return mD3DUsage;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-int TextureStorage9::getLodOffset() const
</del><ins>+int TextureStorage9::getTopLevel() const
</ins><span class="cx"> {
</span><del>- return mLodOffset;
</del><ins>+ return mTopLevel;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-int TextureStorage9::levelCount()
</del><ins>+int TextureStorage9::getLevelCount() const
</ins><span class="cx"> {
</span><del>- return getBaseTexture() ? getBaseTexture()->GetLevelCount() - getLodOffset() : 0;
</del><ins>+ return getBaseTexture() ? (getBaseTexture()->GetLevelCount() - getTopLevel()) : 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain) : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET)
</del><ins>+TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain)
+ : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET)
</ins><span class="cx"> {
</span><span class="cx"> IDirect3DTexture9 *surfaceTexture = swapchain->getOffscreenTexture();
</span><span class="cx"> mTexture = surfaceTexture;
</span><span class="lines">@@ -117,8 +98,8 @@
</span><span class="cx"> initializeRenderTarget();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height)
- : TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable))
</del><ins>+TextureStorage9_2D::TextureStorage9_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
+ : TextureStorage9(renderer, GetTextureUsage(internalformat, Renderer9::makeRenderer9(renderer), renderTarget))
</ins><span class="cx"> {
</span><span class="cx"> mTexture = NULL;
</span><span class="cx"> mRenderTarget = NULL;
</span><span class="lines">@@ -127,10 +108,12 @@
</span><span class="cx"> if (width > 0 && height > 0)
</span><span class="cx"> {
</span><span class="cx"> IDirect3DDevice9 *device = mRenderer->getDevice();
</span><del>- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &width, &height, &mLodOffset);
- HRESULT result = device->CreateTexture(width, height, levels ? levels + mLodOffset : 0, getUsage(),
- mRenderer->ConvertTextureInternalFormat(internalformat), getPool(), &mTexture, NULL);
</del><ins>+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalformat, mRenderer);
+ d3d9::MakeValidSize(false, format, &width, &height, &mTopLevel);
+ UINT creationLevels = (levels == 0) ? 0 : mTopLevel + levels;
</ins><span class="cx">
</span><ins>+ HRESULT result = device->CreateTexture(width, height, creationLevels, getUsage(), format, getPool(), &mTexture, NULL);
+
</ins><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
</span><span class="lines">@@ -143,12 +126,8 @@
</span><span class="cx">
</span><span class="cx"> TextureStorage9_2D::~TextureStorage9_2D()
</span><span class="cx"> {
</span><del>- if (mTexture)
- {
- mTexture->Release();
- }
-
- delete mRenderTarget;
</del><ins>+ SafeRelease(mTexture);
+ SafeDelete(mRenderTarget);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextureStorage9_2D *TextureStorage9_2D::makeTextureStorage9_2D(TextureStorage *storage)
</span><span class="lines">@@ -165,11 +144,11 @@
</span><span class="cx">
</span><span class="cx"> if (mTexture)
</span><span class="cx"> {
</span><del>- HRESULT result = mTexture->GetSurfaceLevel(level + mLodOffset, &surface);
</del><ins>+ HRESULT result = mTexture->GetSurfaceLevel(level + mTopLevel, &surface);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><span class="cx"> // With managed textures the driver needs to be informed of updates to the lower mipmap levels
</span><del>- if (level + mLodOffset != 0 && isManaged() && dirty)
</del><ins>+ if (level + mTopLevel != 0 && isManaged() && dirty)
</ins><span class="cx"> {
</span><span class="cx"> mTexture->AddDirtyRect(NULL);
</span><span class="cx"> }
</span><span class="lines">@@ -178,7 +157,7 @@
</span><span class="cx"> return surface;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget *TextureStorage9_2D::getRenderTarget()
</del><ins>+RenderTarget *TextureStorage9_2D::getRenderTarget(int level)
</ins><span class="cx"> {
</span><span class="cx"> return mRenderTarget;
</span><span class="cx"> }
</span><span class="lines">@@ -193,8 +172,8 @@
</span><span class="cx"> mRenderer->boxFilter(upper, lower);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (upper != NULL) upper->Release();
- if (lower != NULL) lower->Release();
</del><ins>+ SafeRelease(upper);
+ SafeRelease(lower);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> IDirect3DBaseTexture9 *TextureStorage9_2D::getBaseTexture() const
</span><span class="lines">@@ -214,8 +193,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextureStorage9_Cube::TextureStorage9_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size)
- : TextureStorage9(renderer, GetTextureUsage(Renderer9::makeRenderer9(renderer)->ConvertTextureInternalFormat(internalformat), usage, forceRenderable))
</del><ins>+TextureStorage9_Cube::TextureStorage9_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels)
+ : TextureStorage9(renderer, GetTextureUsage(internalformat, Renderer9::makeRenderer9(renderer), renderTarget))
</ins><span class="cx"> {
</span><span class="cx"> mTexture = NULL;
</span><span class="cx"> for (int i = 0; i < 6; ++i)
</span><span class="lines">@@ -229,10 +208,12 @@
</span><span class="cx"> {
</span><span class="cx"> IDirect3DDevice9 *device = mRenderer->getDevice();
</span><span class="cx"> int height = size;
</span><del>- gl::MakeValidSize(false, gl::IsCompressed(internalformat), &size, &height, &mLodOffset);
- HRESULT result = device->CreateCubeTexture(size, levels ? levels + mLodOffset : 0, getUsage(),
- mRenderer->ConvertTextureInternalFormat(internalformat), getPool(), &mTexture, NULL);
</del><ins>+ D3DFORMAT format = gl_d3d9::GetTextureFormat(internalformat, mRenderer);
+ d3d9::MakeValidSize(false, format, &size, &height, &mTopLevel);
+ UINT creationLevels = (levels == 0) ? 0 : mTopLevel + levels;
</ins><span class="cx">
</span><ins>+ HRESULT result = device->CreateCubeTexture(size, creationLevels, getUsage(), format, getPool(), &mTexture, NULL);
+
</ins><span class="cx"> if (FAILED(result))
</span><span class="cx"> {
</span><span class="cx"> ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
</span><span class="lines">@@ -245,14 +226,11 @@
</span><span class="cx">
</span><span class="cx"> TextureStorage9_Cube::~TextureStorage9_Cube()
</span><span class="cx"> {
</span><del>- if (mTexture)
- {
- mTexture->Release();
- }
</del><ins>+ SafeRelease(mTexture);
</ins><span class="cx">
</span><span class="cx"> for (int i = 0; i < 6; ++i)
</span><span class="cx"> {
</span><del>- delete mRenderTarget[i];
</del><ins>+ SafeDelete(mRenderTarget[i]);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -271,7 +249,7 @@
</span><span class="cx"> if (mTexture)
</span><span class="cx"> {
</span><span class="cx"> D3DCUBEMAP_FACES face = gl_d3d9::ConvertCubeFace(faceTarget);
</span><del>- HRESULT result = mTexture->GetCubeMapSurface(face, level + mLodOffset, &surface);
</del><ins>+ HRESULT result = mTexture->GetCubeMapSurface(face, level + mTopLevel, &surface);
</ins><span class="cx"> ASSERT(SUCCEEDED(result));
</span><span class="cx">
</span><span class="cx"> // With managed textures the driver needs to be informed of updates to the lower mipmap levels
</span><span class="lines">@@ -284,23 +262,23 @@
</span><span class="cx"> return surface;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderTarget *TextureStorage9_Cube::getRenderTarget(GLenum faceTarget)
</del><ins>+RenderTarget *TextureStorage9_Cube::getRenderTargetFace(GLenum faceTarget, int level)
</ins><span class="cx"> {
</span><del>- return mRenderTarget[gl::TextureCubeMap::faceIndex(faceTarget)];
</del><ins>+ return mRenderTarget[gl::TextureCubeMap::targetToIndex(faceTarget)];
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextureStorage9_Cube::generateMipmap(int face, int level)
</del><ins>+void TextureStorage9_Cube::generateMipmap(int faceIndex, int level)
</ins><span class="cx"> {
</span><del>- IDirect3DSurface9 *upper = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level - 1, false);
- IDirect3DSurface9 *lower = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, true);
</del><ins>+ IDirect3DSurface9 *upper = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level - 1, false);
+ IDirect3DSurface9 *lower = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, true);
</ins><span class="cx">
</span><span class="cx"> if (upper != NULL && lower != NULL)
</span><span class="cx"> {
</span><span class="cx"> mRenderer->boxFilter(upper, lower);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (upper != NULL) upper->Release();
- if (lower != NULL) lower->Release();
</del><ins>+ SafeRelease(upper);
+ SafeRelease(lower);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> IDirect3DBaseTexture9 *TextureStorage9_Cube::getBaseTexture() const
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9TextureStorage9h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/TextureStorage9.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2012-2013 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">@@ -20,37 +20,37 @@
</span><span class="cx"> class SwapChain9;
</span><span class="cx"> class RenderTarget;
</span><span class="cx"> class RenderTarget9;
</span><del>-class Blit;
</del><span class="cx">
</span><span class="cx"> class TextureStorage9 : public TextureStorage
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- TextureStorage9(Renderer *renderer, DWORD usage);
</del><span class="cx"> virtual ~TextureStorage9();
</span><span class="cx">
</span><span class="cx"> static TextureStorage9 *makeTextureStorage9(TextureStorage *storage);
</span><span class="cx">
</span><del>- static DWORD GetTextureUsage(D3DFORMAT d3dfmt, GLenum glusage, bool forceRenderable);
- static bool IsTextureFormatRenderable(D3DFORMAT format);
</del><ins>+ static DWORD GetTextureUsage(GLenum internalformat, Renderer9 *renderer, bool renderTarget);
</ins><span class="cx">
</span><span class="cx"> D3DPOOL getPool() const;
</span><span class="cx"> DWORD getUsage() const;
</span><span class="cx">
</span><span class="cx"> virtual IDirect3DBaseTexture9 *getBaseTexture() const = 0;
</span><del>- virtual RenderTarget *getRenderTarget() { return NULL; }
- virtual RenderTarget *getRenderTarget(GLenum faceTarget) { return NULL; }
</del><ins>+ virtual RenderTarget *getRenderTarget(int level) { return NULL; }
+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level) { return NULL; }
+ virtual RenderTarget *getRenderTargetLayer(int mipLevel, int layer) { return NULL; }
</ins><span class="cx"> virtual void generateMipmap(int level) {};
</span><span class="cx"> virtual void generateMipmap(int face, int level) {};
</span><span class="cx">
</span><del>- virtual int getLodOffset() const;
</del><ins>+ virtual int getTopLevel() const;
</ins><span class="cx"> virtual bool isRenderTarget() const;
</span><span class="cx"> virtual bool isManaged() const;
</span><del>- virtual int levelCount();
</del><ins>+ virtual int getLevelCount() const;
</ins><span class="cx">
</span><span class="cx"> protected:
</span><del>- int mLodOffset;
</del><ins>+ int mTopLevel;
</ins><span class="cx"> Renderer9 *mRenderer;
</span><span class="cx">
</span><ins>+ TextureStorage9(Renderer *renderer, DWORD usage);
+
</ins><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureStorage9);
</span><span class="cx">
</span><span class="lines">@@ -62,13 +62,13 @@
</span><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx"> TextureStorage9_2D(Renderer *renderer, SwapChain9 *swapchain);
</span><del>- TextureStorage9_2D(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height);
</del><ins>+ TextureStorage9_2D(Renderer *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
</ins><span class="cx"> virtual ~TextureStorage9_2D();
</span><span class="cx">
</span><span class="cx"> static TextureStorage9_2D *makeTextureStorage9_2D(TextureStorage *storage);
</span><span class="cx">
</span><span class="cx"> IDirect3DSurface9 *getSurfaceLevel(int level, bool dirty);
</span><del>- virtual RenderTarget *getRenderTarget();
</del><ins>+ virtual RenderTarget *getRenderTarget(int level);
</ins><span class="cx"> virtual IDirect3DBaseTexture9 *getBaseTexture() const;
</span><span class="cx"> virtual void generateMipmap(int level);
</span><span class="cx">
</span><span class="lines">@@ -84,15 +84,15 @@
</span><span class="cx"> class TextureStorage9_Cube : public TextureStorage9
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>- TextureStorage9_Cube(Renderer *renderer, int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size);
</del><ins>+ TextureStorage9_Cube(Renderer *renderer, GLenum internalformat, bool renderTarget, int size, int levels);
</ins><span class="cx"> virtual ~TextureStorage9_Cube();
</span><span class="cx">
</span><span class="cx"> static TextureStorage9_Cube *makeTextureStorage9_Cube(TextureStorage *storage);
</span><span class="cx">
</span><span class="cx"> IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level, bool dirty);
</span><del>- virtual RenderTarget *getRenderTarget(GLenum faceTarget);
</del><ins>+ virtual RenderTarget *getRenderTargetFace(GLenum faceTarget, int level);
</ins><span class="cx"> virtual IDirect3DBaseTexture9 *getBaseTexture() const;
</span><del>- virtual void generateMipmap(int face, int level);
</del><ins>+ virtual void generateMipmap(int faceIndex, int level);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> DISALLOW_COPY_AND_ASSIGN(TextureStorage9_Cube);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9VertexBuffer9cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -8,48 +8,32 @@
</span><span class="cx"> // VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
</span><del>-#include "libGLESv2/renderer/d3d9/vertexconversion.h"
</del><ins>+#include "libGLESv2/renderer/vertexconversion.h"
</ins><span class="cx"> #include "libGLESv2/renderer/BufferStorage.h"
</span><del>-#include "libGLESv2/Context.h"
</del><ins>+#include "libGLESv2/VertexAttribute.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d9/Renderer9.h"
</span><ins>+#include "libGLESv2/renderer/d3d9/formatutils9.h"
</ins><span class="cx">
</span><span class="cx"> #include "libGLESv2/Buffer.h"
</span><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx">
</span><del>-bool VertexBuffer9::mTranslationsInitialized = false;
-VertexBuffer9::FormatConverter VertexBuffer9::mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
-
</del><span class="cx"> VertexBuffer9::VertexBuffer9(rx::Renderer9 *const renderer) : mRenderer(renderer)
</span><span class="cx"> {
</span><span class="cx"> mVertexBuffer = NULL;
</span><span class="cx"> mBufferSize = 0;
</span><span class="cx"> mDynamicUsage = false;
</span><del>-
- if (!mTranslationsInitialized)
- {
- initializeTranslations(renderer->getCapsDeclTypes());
- mTranslationsInitialized = true;
- }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> VertexBuffer9::~VertexBuffer9()
</span><span class="cx"> {
</span><del>- if (mVertexBuffer)
- {
- mVertexBuffer->Release();
- mVertexBuffer = NULL;
- }
</del><ins>+ SafeRelease(mVertexBuffer);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool VertexBuffer9::initialize(unsigned int size, bool dynamicUsage)
</span><span class="cx"> {
</span><del>- if (mVertexBuffer)
- {
- mVertexBuffer->Release();
- mVertexBuffer = NULL;
- }
</del><ins>+ SafeRelease(mVertexBuffer);
</ins><span class="cx">
</span><span class="cx"> updateSerial();
</span><span class="cx">
</span><span class="lines">@@ -81,8 +65,8 @@
</span><span class="cx"> return static_cast<VertexBuffer9*>(vertexBuffer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count,
- GLsizei instances, unsigned int offset)
</del><ins>+bool VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset)
</ins><span class="cx"> {
</span><span class="cx"> if (mVertexBuffer)
</span><span class="cx"> {
</span><span class="lines">@@ -90,7 +74,6 @@
</span><span class="cx">
</span><span class="cx"> int inputStride = attrib.stride();
</span><span class="cx"> int elementSize = attrib.typeSize();
</span><del>- const FormatConverter &converter = formatConverter(attrib);
</del><span class="cx">
</span><span class="cx"> DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
</span><span class="cx">
</span><span class="lines">@@ -111,14 +94,21 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const char *input = NULL;
</span><del>- if (buffer)
</del><ins>+ if (attrib.mArrayEnabled)
</ins><span class="cx"> {
</span><del>- BufferStorage *storage = buffer->getStorage();
- input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
</del><ins>+ if (buffer)
+ {
+ BufferStorage *storage = buffer->getStorage();
+ input = static_cast<const char*>(storage->getData()) + static_cast<int>(attrib.mOffset);
+ }
+ else
+ {
+ input = static_cast<const char*>(attrib.mPointer);
+ }
</ins><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- input = static_cast<const char*>(attrib.mPointer);
</del><ins>+ input = reinterpret_cast<const char*>(currentValue.FloatValues);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (instances == 0 || attrib.mDivisor == 0)
</span><span class="lines">@@ -126,13 +116,17 @@
</span><span class="cx"> input += inputStride * start;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (converter.identity && inputStride == elementSize)
</del><ins>+ gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+ bool needsConversion = (d3d9::GetVertexConversionType(vertexFormat) & VERTEX_CONVERT_CPU) > 0;
+
+ if (!needsConversion && inputStride == elementSize)
</ins><span class="cx"> {
</span><span class="cx"> memcpy(mapPtr, input, count * inputStride);
</span><span class="cx"> }
</span><span class="cx"> else
</span><span class="cx"> {
</span><del>- converter.convertArray(input, inputStride, count, mapPtr);
</del><ins>+ VertexCopyFunction copyFunction = d3d9::GetVertexCopyFunction(vertexFormat);
+ copyFunction(input, inputStride, count, mapPtr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mVertexBuffer->Unlock();
</span><span class="lines">@@ -146,56 +140,12 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool VertexBuffer9::storeRawData(const void* data, unsigned int size, unsigned int offset)
-{
- if (mVertexBuffer)
- {
- DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
-
- void *mapPtr = NULL;
- HRESULT result = mVertexBuffer->Lock(offset, size, &mapPtr, lockFlags);
-
- if (FAILED(result))
- {
- ERR("Lock failed with error 0x%08x", result);
- return false;
- }
-
- memcpy(mapPtr, data, size);
-
- mVertexBuffer->Unlock();
-
- return true;
- }
- else
- {
- ERR("Vertex buffer not initialized.");
- return false;
- }
-}
-
</del><span class="cx"> bool VertexBuffer9::getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances,
</span><span class="cx"> unsigned int *outSpaceRequired) const
</span><span class="cx"> {
</span><span class="cx"> return spaceRequired(attrib, count, instances, outSpaceRequired);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool VertexBuffer9::requiresConversion(const gl::VertexAttribute &attrib) const
-{
- return !formatConverter(attrib).identity;
-}
-
-unsigned int VertexBuffer9::getVertexSize(const gl::VertexAttribute &attrib) const
-{
- unsigned int spaceRequired;
- return getSpaceRequired(attrib, 1, 0, &spaceRequired) ? spaceRequired : 0;
-}
-
-D3DDECLTYPE VertexBuffer9::getDeclType(const gl::VertexAttribute &attrib) const
-{
- return formatConverter(attrib).d3dDeclType;
-}
-
</del><span class="cx"> unsigned int VertexBuffer9::getBufferSize() const
</span><span class="cx"> {
</span><span class="cx"> return mBufferSize;
</span><span class="lines">@@ -248,240 +198,11 @@
</span><span class="cx"> return mVertexBuffer;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Mapping from OpenGL-ES vertex attrib type to D3D decl type:
-//
-// BYTE SHORT (Cast)
-// BYTE-norm FLOAT (Normalize) (can't be exactly represented as SHORT-norm)
-// UNSIGNED_BYTE UBYTE4 (Identity) or SHORT (Cast)
-// UNSIGNED_BYTE-norm UBYTE4N (Identity) or FLOAT (Normalize)
-// SHORT SHORT (Identity)
-// SHORT-norm SHORT-norm (Identity) or FLOAT (Normalize)
-// UNSIGNED_SHORT FLOAT (Cast)
-// UNSIGNED_SHORT-norm USHORT-norm (Identity) or FLOAT (Normalize)
-// FIXED (not in WebGL) FLOAT (FixedToFloat)
-// FLOAT FLOAT (Identity)
-
-// GLToCType maps from GL type (as GLenum) to the C typedef.
-template <GLenum GLType> struct GLToCType { };
-
-template <> struct GLToCType<GL_BYTE> { typedef GLbyte type; };
-template <> struct GLToCType<GL_UNSIGNED_BYTE> { typedef GLubyte type; };
-template <> struct GLToCType<GL_SHORT> { typedef GLshort type; };
-template <> struct GLToCType<GL_UNSIGNED_SHORT> { typedef GLushort type; };
-template <> struct GLToCType<GL_FIXED> { typedef GLuint type; };
-template <> struct GLToCType<GL_FLOAT> { typedef GLfloat type; };
-
-// This differs from D3DDECLTYPE in that it is unsized. (Size expansion is applied last.)
-enum D3DVertexType
-{
- D3DVT_FLOAT,
- D3DVT_SHORT,
- D3DVT_SHORT_NORM,
- D3DVT_UBYTE,
- D3DVT_UBYTE_NORM,
- D3DVT_USHORT_NORM
-};
-
-// D3DToCType maps from D3D vertex type (as enum D3DVertexType) to the corresponding C type.
-template <unsigned int D3DType> struct D3DToCType { };
-
-template <> struct D3DToCType<D3DVT_FLOAT> { typedef float type; };
-template <> struct D3DToCType<D3DVT_SHORT> { typedef short type; };
-template <> struct D3DToCType<D3DVT_SHORT_NORM> { typedef short type; };
-template <> struct D3DToCType<D3DVT_UBYTE> { typedef unsigned char type; };
-template <> struct D3DToCType<D3DVT_UBYTE_NORM> { typedef unsigned char type; };
-template <> struct D3DToCType<D3DVT_USHORT_NORM> { typedef unsigned short type; };
-
-// Encode the type/size combinations that D3D permits. For each type/size it expands to a widener that will provide the appropriate final size.
-template <unsigned int type, int size> struct WidenRule { };
-
-template <int size> struct WidenRule<D3DVT_FLOAT, size> : NoWiden<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT, size> : WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT_NORM, size> : WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE, size> : WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE_NORM, size> : WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_USHORT_NORM, size> : WidenToEven<size> { };
-
-// VertexTypeFlags encodes the D3DCAPS9::DeclType flag and vertex declaration flag for each D3D vertex type & size combination.
-template <unsigned int d3dtype, int size> struct VertexTypeFlags { };
-
-template <unsigned int _capflag, unsigned int _declflag>
-struct VertexTypeFlagsHelper
-{
- enum { capflag = _capflag };
- enum { declflag = _declflag };
-};
-
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 1> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT1> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT2> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 3> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT3> { };
-template <> struct VertexTypeFlags<D3DVT_FLOAT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_FLOAT4> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT, 2> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT2> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT, 4> : VertexTypeFlagsHelper<0, D3DDECLTYPE_SHORT4> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT2N, D3DDECLTYPE_SHORT2N> { };
-template <> struct VertexTypeFlags<D3DVT_SHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_SHORT4N, D3DDECLTYPE_SHORT4N> { };
-template <> struct VertexTypeFlags<D3DVT_UBYTE, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4, D3DDECLTYPE_UBYTE4> { };
-template <> struct VertexTypeFlags<D3DVT_UBYTE_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_UBYTE4N, D3DDECLTYPE_UBYTE4N> { };
-template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 2> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT2N, D3DDECLTYPE_USHORT2N> { };
-template <> struct VertexTypeFlags<D3DVT_USHORT_NORM, 4> : VertexTypeFlagsHelper<D3DDTCAPS_USHORT4N, D3DDECLTYPE_USHORT4N> { };
-
-
-// VertexTypeMapping maps GL type & normalized flag to preferred and fallback D3D vertex types (as D3DVertexType enums).
-template <GLenum GLtype, bool normalized> struct VertexTypeMapping { };
-
-template <D3DVertexType Preferred, D3DVertexType Fallback = Preferred>
-struct VertexTypeMappingBase
-{
- enum { preferred = Preferred };
- enum { fallback = Fallback };
-};
-
-template <> struct VertexTypeMapping<GL_BYTE, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Cast
-template <> struct VertexTypeMapping<GL_BYTE, true> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Normalize
-template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, false> : VertexTypeMappingBase<D3DVT_UBYTE, D3DVT_FLOAT> { }; // Identity, Cast
-template <> struct VertexTypeMapping<GL_UNSIGNED_BYTE, true> : VertexTypeMappingBase<D3DVT_UBYTE_NORM, D3DVT_FLOAT> { }; // Identity, Normalize
-template <> struct VertexTypeMapping<GL_SHORT, false> : VertexTypeMappingBase<D3DVT_SHORT> { }; // Identity
-template <> struct VertexTypeMapping<GL_SHORT, true> : VertexTypeMappingBase<D3DVT_SHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
-template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, false> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Cast
-template <> struct VertexTypeMapping<GL_UNSIGNED_SHORT, true> : VertexTypeMappingBase<D3DVT_USHORT_NORM, D3DVT_FLOAT> { }; // Cast, Normalize
-template <bool normalized> struct VertexTypeMapping<GL_FIXED, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // FixedToFloat
-template <bool normalized> struct VertexTypeMapping<GL_FLOAT, normalized> : VertexTypeMappingBase<D3DVT_FLOAT> { }; // Identity
-
-
-// Given a GL type & norm flag and a D3D type, ConversionRule provides the type conversion rule (Cast, Normalize, Identity, FixedToFloat).
-// The conversion rules themselves are defined in vertexconversion.h.
-
-// Almost all cases are covered by Cast (including those that are actually Identity since Cast<T,T> knows it's an identity mapping).
-template <GLenum fromType, bool normalized, unsigned int toType>
-struct ConversionRule : Cast<typename GLToCType<fromType>::type, typename D3DToCType<toType>::type> { };
-
-// All conversions from normalized types to float use the Normalize operator.
-template <GLenum fromType> struct ConversionRule<fromType, true, D3DVT_FLOAT> : Normalize<typename GLToCType<fromType>::type> { };
-
-// Use a full specialization for this so that it preferentially matches ahead of the generic normalize-to-float rules.
-template <> struct ConversionRule<GL_FIXED, true, D3DVT_FLOAT> : FixedToFloat<GLint, 16> { };
-template <> struct ConversionRule<GL_FIXED, false, D3DVT_FLOAT> : FixedToFloat<GLint, 16> { };
-
-// A 2-stage construction is used for DefaultVertexValues because float must use SimpleDefaultValues (i.e. 0/1)
-// whether it is normalized or not.
-template <class T, bool normalized> struct DefaultVertexValuesStage2 { };
-
-template <class T> struct DefaultVertexValuesStage2<T, true> : NormalizedDefaultValues<T> { };
-template <class T> struct DefaultVertexValuesStage2<T, false> : SimpleDefaultValues<T> { };
-
-// Work out the default value rule for a D3D type (expressed as the C type) and
-template <class T, bool normalized> struct DefaultVertexValues : DefaultVertexValuesStage2<T, normalized> { };
-template <bool normalized> struct DefaultVertexValues<float, normalized> : SimpleDefaultValues<float> { };
-
-// Policy rules for use with Converter, to choose whether to use the preferred or fallback conversion.
-// The fallback conversion produces an output that all D3D9 devices must support.
-template <class T> struct UsePreferred { enum { type = T::preferred }; };
-template <class T> struct UseFallback { enum { type = T::fallback }; };
-
-// Converter ties it all together. Given an OpenGL type/norm/size and choice of preferred/fallback conversion,
-// it provides all the members of the appropriate VertexDataConverter, the D3DCAPS9::DeclTypes flag in cap flag
-// and the D3DDECLTYPE member needed for the vertex declaration in declflag.
-template <GLenum fromType, bool normalized, int size, template <class T> class PreferenceRule>
-struct Converter
- : VertexDataConverter<typename GLToCType<fromType>::type,
- WidenRule<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type, size>,
- ConversionRule<fromType,
- normalized,
- PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>,
- DefaultVertexValues<typename D3DToCType<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>::type, normalized > >
-{
-private:
- enum { d3dtype = PreferenceRule< VertexTypeMapping<fromType, normalized> >::type };
- enum { d3dsize = WidenRule<d3dtype, size>::finalWidth };
-
-public:
- enum { capflag = VertexTypeFlags<d3dtype, d3dsize>::capflag };
- enum { declflag = VertexTypeFlags<d3dtype, d3dsize>::declflag };
-};
-
-// Initialize a TranslationInfo
-#define TRANSLATION(type, norm, size, preferred) \
- { \
- Converter<type, norm, size, preferred>::identity, \
- Converter<type, norm, size, preferred>::finalSize, \
- Converter<type, norm, size, preferred>::convertArray, \
- static_cast<D3DDECLTYPE>(Converter<type, norm, size, preferred>::declflag) \
- }
-
-#define TRANSLATION_FOR_TYPE_NORM_SIZE(type, norm, size) \
- { \
- Converter<type, norm, size, UsePreferred>::capflag, \
- TRANSLATION(type, norm, size, UsePreferred), \
- TRANSLATION(type, norm, size, UseFallback) \
- }
-
-#define TRANSLATIONS_FOR_TYPE(type) \
- { \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, true, 4) }, \
- }
-
-#define TRANSLATIONS_FOR_TYPE_NO_NORM(type) \
- { \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
- { TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 1), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 2), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 3), TRANSLATION_FOR_TYPE_NORM_SIZE(type, false, 4) }, \
- }
-
-const VertexBuffer9::TranslationDescription VertexBuffer9::mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4] = // [GL types as enumerated by typeIndex()][normalized][size-1]
-{
- TRANSLATIONS_FOR_TYPE(GL_BYTE),
- TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_BYTE),
- TRANSLATIONS_FOR_TYPE(GL_SHORT),
- TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_SHORT),
- TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FIXED),
- TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FLOAT)
-};
-
-void VertexBuffer9::initializeTranslations(DWORD declTypes)
-{
- for (unsigned int i = 0; i < NUM_GL_VERTEX_ATTRIB_TYPES; i++)
- {
- for (unsigned int j = 0; j < 2; j++)
- {
- for (unsigned int k = 0; k < 4; k++)
- {
- if (mPossibleTranslations[i][j][k].capsFlag == 0 || (declTypes & mPossibleTranslations[i][j][k].capsFlag) != 0)
- {
- mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].preferredConversion;
- }
- else
- {
- mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].fallbackConversion;
- }
- }
- }
- }
-}
-
-unsigned int VertexBuffer9::typeIndex(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 VertexBuffer9::FormatConverter &VertexBuffer9::formatConverter(const gl::VertexAttribute &attribute)
-{
- return mFormatConverters[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1];
-}
-
</del><span class="cx"> bool VertexBuffer9::spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
</span><span class="cx"> unsigned int *outSpaceRequired)
</span><span class="cx"> {
</span><del>- unsigned int elementSize = formatConverter(attrib).outputElementSize;
</del><ins>+ gl::VertexFormat vertexFormat(attrib, GL_FLOAT);
+ unsigned int elementSize = d3d9::GetVertexElementSize(vertexFormat);
</ins><span class="cx">
</span><span class="cx"> if (attrib.mArrayEnabled)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9VertexBuffer9h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexBuffer9.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -25,17 +25,11 @@
</span><span class="cx">
</span><span class="cx"> static VertexBuffer9 *makeVertexBuffer9(VertexBuffer *vertexBuffer);
</span><span class="cx">
</span><del>- virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, GLint start, GLsizei count, GLsizei instances,
- unsigned int offset);
- virtual bool storeRawData(const void* data, unsigned int size, unsigned int offset);
</del><ins>+ virtual bool storeVertexAttributes(const gl::VertexAttribute &attrib, const gl::VertexAttribCurrentValueData &currentValue,
+ GLint start, GLsizei count, GLsizei instances, unsigned int offset);
</ins><span class="cx">
</span><span class="cx"> virtual bool getSpaceRequired(const gl::VertexAttribute &attrib, GLsizei count, GLsizei instances, unsigned int *outSpaceRequired) const;
</span><span class="cx">
</span><del>- virtual bool requiresConversion(const gl::VertexAttribute &attrib) const;
-
- unsigned int getVertexSize(const gl::VertexAttribute &attrib) const;
- D3DDECLTYPE getDeclType(const gl::VertexAttribute &attrib) const;
-
</del><span class="cx"> virtual unsigned int getBufferSize() const;
</span><span class="cx"> virtual bool setBufferSize(unsigned int size);
</span><span class="cx"> virtual bool discard();
</span><span class="lines">@@ -51,37 +45,6 @@
</span><span class="cx"> unsigned int mBufferSize;
</span><span class="cx"> bool mDynamicUsage;
</span><span class="cx">
</span><del>- // Attribute format conversion
- enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
-
- struct FormatConverter
- {
- bool identity;
- std::size_t outputElementSize;
- void (*convertArray)(const void *in, std::size_t stride, std::size_t n, void *out);
- D3DDECLTYPE d3dDeclType;
- };
-
- static bool mTranslationsInitialized;
- static void initializeTranslations(DWORD declTypes);
-
- // [GL types as enumerated by typeIndex()][normalized][size - 1]
- static FormatConverter mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
-
- struct TranslationDescription
- {
- DWORD capsFlag;
- FormatConverter preferredConversion;
- FormatConverter fallbackConversion;
- };
-
- // This table is used to generate mFormatConverters.
- // [GL types as enumerated by typeIndex()][normalized][size - 1]
- static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
-
- static unsigned int typeIndex(GLenum type);
- static const FormatConverter &formatConverter(const gl::VertexAttribute &attribute);
-
</del><span class="cx"> static bool spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances,
</span><span class="cx"> unsigned int *outSpaceRequired);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9VertexDeclarationCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/VertexDeclarationCache.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -8,9 +8,10 @@
</span><span class="cx"> // VertexDeclarationCache.cpp: Implements a helper class to construct and cache vertex declarations.
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/ProgramBinary.h"
</span><del>-#include "libGLESv2/Context.h"
</del><ins>+#include "libGLESv2/VertexAttribute.h"
</ins><span class="cx"> #include "libGLESv2/renderer/d3d9/VertexBuffer9.h"
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/VertexDeclarationCache.h"
</span><ins>+#include "libGLESv2/renderer/d3d9/formatutils9.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="lines">@@ -36,10 +37,7 @@
</span><span class="cx"> {
</span><span class="cx"> for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
</span><span class="cx"> {
</span><del>- if (mVertexDeclCache[i].vertexDeclaration)
- {
- mVertexDeclCache[i].vertexDeclaration->Release();
- }
</del><ins>+ SafeRelease(mVertexDeclCache[i].vertexDeclaration);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -134,9 +132,11 @@
</span><span class="cx"> mAppliedVBs[stream].offset = attributes[i].offset;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ gl::VertexFormat vertexFormat(*attributes[i].attribute, GL_FLOAT);
+
</ins><span class="cx"> element->Stream = stream;
</span><span class="cx"> element->Offset = 0;
</span><del>- element->Type = attributes[i].attribute->mArrayEnabled ? vertexBuffer->getDeclType(*attributes[i].attribute) : D3DDECLTYPE_FLOAT4;
</del><ins>+ element->Type = d3d9::GetNativeVertexFormat(vertexFormat);
</ins><span class="cx"> element->Method = D3DDECLMETHOD_DEFAULT;
</span><span class="cx"> element->Usage = D3DDECLUSAGE_TEXCOORD;
</span><span class="cx"> element->UsageIndex = programBinary->getSemanticIndex(i);
</span><span class="lines">@@ -188,8 +188,7 @@
</span><span class="cx">
</span><span class="cx"> if (lastCache->vertexDeclaration != NULL)
</span><span class="cx"> {
</span><del>- lastCache->vertexDeclaration->Release();
- lastCache->vertexDeclaration = NULL;
</del><ins>+ SafeRelease(lastCache->vertexDeclaration);
</ins><span class="cx"> // mLastSetVDecl is set to the replacement, so we don't have to worry
</span><span class="cx"> // about it.
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9renderer9_utilscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -9,11 +9,14 @@
</span><span class="cx"> // specific to the D3D9 renderer.
</span><span class="cx">
</span><span class="cx"> #include "libGLESv2/renderer/d3d9/renderer9_utils.h"
</span><del>-#include "libGLESv2/mathutil.h"
</del><ins>+#include "common/mathutil.h"
</ins><span class="cx"> #include "libGLESv2/Context.h"
</span><span class="cx">
</span><span class="cx"> #include "common/debug.h"
</span><span class="cx">
</span><ins>+namespace rx
+{
+
</ins><span class="cx"> namespace gl_d3d9
</span><span class="cx"> {
</span><span class="cx">
</span><span class="lines">@@ -36,7 +39,7 @@
</span><span class="cx"> return d3dComp;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-D3DCOLOR ConvertColor(gl::Color color)
</del><ins>+D3DCOLOR ConvertColor(gl::ColorF color)
</ins><span class="cx"> {
</span><span class="cx"> return D3DCOLOR_RGBA(gl::unorm<8>(color.red),
</span><span class="cx"> gl::unorm<8>(color.green),
</span><span class="lines">@@ -80,6 +83,8 @@
</span><span class="cx"> case GL_FUNC_ADD: d3dBlendOp = D3DBLENDOP_ADD; break;
</span><span class="cx"> case GL_FUNC_SUBTRACT: d3dBlendOp = D3DBLENDOP_SUBTRACT; break;
</span><span class="cx"> case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3DBLENDOP_REVSUBTRACT; break;
</span><ins>+ case GL_MIN_EXT: d3dBlendOp = D3DBLENDOP_MIN; break;
+ case GL_MAX_EXT: d3dBlendOp = D3DBLENDOP_MAX; break;
</ins><span class="cx"> default: UNREACHABLE();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -237,264 +242,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-D3DFORMAT ConvertRenderbufferFormat(GLenum format)
-{
- switch (format)
- {
- case GL_NONE: return D3DFMT_NULL;
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8_OES: return D3DFMT_A8R8G8B8;
- case GL_RGB565: return D3DFMT_R5G6B5;
- case GL_RGB8_OES: return D3DFMT_X8R8G8B8;
- case GL_DEPTH_COMPONENT16:
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES: return D3DFMT_D24S8;
- default: UNREACHABLE(); return D3DFMT_A8R8G8B8;
- }
</del><span class="cx"> }
</span><span class="cx">
</span><del>-D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples)
-{
- if (samples <= 1)
- return D3DMULTISAMPLE_NONE;
- else
- return (D3DMULTISAMPLE_TYPE)samples;
</del><span class="cx"> }
</span><del>-
-}
-
-namespace d3d9_gl
-{
-
-unsigned int GetStencilSize(D3DFORMAT stencilFormat)
-{
- if (stencilFormat == D3DFMT_INTZ)
- {
- return 8;
- }
- switch(stencilFormat)
- {
- case D3DFMT_D24FS8:
- case D3DFMT_D24S8:
- return 8;
- case D3DFMT_D24X4S4:
- return 4;
- case D3DFMT_D15S1:
- return 1;
- case D3DFMT_D16_LOCKABLE:
- case D3DFMT_D32:
- case D3DFMT_D24X8:
- case D3DFMT_D32F_LOCKABLE:
- case D3DFMT_D16:
- return 0;
- //case D3DFMT_D32_LOCKABLE: return 0; // DirectX 9Ex only
- //case D3DFMT_S8_LOCKABLE: return 8; // DirectX 9Ex only
- default:
- return 0;
- }
-}
-
-unsigned int GetAlphaSize(D3DFORMAT colorFormat)
-{
- switch (colorFormat)
- {
- case D3DFMT_A16B16G16R16F:
- return 16;
- case D3DFMT_A32B32G32R32F:
- return 32;
- case D3DFMT_A2R10G10B10:
- return 2;
- case D3DFMT_A8R8G8B8:
- return 8;
- case D3DFMT_A1R5G5B5:
- return 1;
- case D3DFMT_X8R8G8B8:
- case D3DFMT_R5G6B5:
- return 0;
- default:
- return 0;
- }
-}
-
-GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type)
-{
- if (type == D3DMULTISAMPLE_NONMASKABLE)
- return 0;
- else
- return type;
-}
-
-bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format)
-{
- switch (d3dformat)
- {
- case D3DFMT_L8:
- return (format == GL_LUMINANCE);
- case D3DFMT_A8L8:
- return (format == GL_LUMINANCE_ALPHA);
- case D3DFMT_DXT1:
- return (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT || format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
- case D3DFMT_DXT3:
- return (format == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE);
- case D3DFMT_DXT5:
- return (format == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE);
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A16B16G16R16F:
- case D3DFMT_A32B32G32R32F:
- return (format == GL_RGBA || format == GL_BGRA_EXT);
- case D3DFMT_X8R8G8B8:
- return (format == GL_RGB);
- default:
- if (d3dformat == D3DFMT_INTZ && gl::IsDepthTexture(format))
- return true;
- return false;
- }
-}
-
-GLenum ConvertBackBufferFormat(D3DFORMAT format)
-{
- switch (format)
- {
- case D3DFMT_A4R4G4B4: return GL_RGBA4;
- case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
- case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
- case D3DFMT_R5G6B5: return GL_RGB565;
- case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
- default:
- UNREACHABLE();
- }
-
- return GL_RGBA4;
-}
-
-GLenum ConvertDepthStencilFormat(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- {
- return GL_DEPTH24_STENCIL8_OES;
- }
- switch (format)
- {
- case D3DFMT_D16:
- case D3DFMT_D24X8:
- return GL_DEPTH_COMPONENT16;
- case D3DFMT_D24S8:
- return GL_DEPTH24_STENCIL8_OES;
- case D3DFMT_UNKNOWN:
- return GL_NONE;
- default:
- UNREACHABLE();
- }
-
- return GL_DEPTH24_STENCIL8_OES;
-}
-
-GLenum ConvertRenderTargetFormat(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- {
- return GL_DEPTH24_STENCIL8_OES;
- }
-
- switch (format)
- {
- case D3DFMT_A4R4G4B4: return GL_RGBA4;
- case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
- case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
- case D3DFMT_R5G6B5: return GL_RGB565;
- case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
- case D3DFMT_D16:
- case D3DFMT_D24X8:
- return GL_DEPTH_COMPONENT16;
- case D3DFMT_D24S8:
- return GL_DEPTH24_STENCIL8_OES;
- case D3DFMT_UNKNOWN:
- return GL_NONE;
- default:
- UNREACHABLE();
- }
-
- return GL_RGBA4;
-}
-
-GLenum GetEquivalentFormat(D3DFORMAT format)
-{
- if (format == D3DFMT_INTZ)
- return GL_DEPTH24_STENCIL8_OES;
- if (format == D3DFMT_NULL)
- return GL_NONE;
-
- switch (format)
- {
- case D3DFMT_A4R4G4B4: return GL_RGBA4;
- case D3DFMT_A8R8G8B8: return GL_RGBA8_OES;
- case D3DFMT_A1R5G5B5: return GL_RGB5_A1;
- case D3DFMT_R5G6B5: return GL_RGB565;
- case D3DFMT_X8R8G8B8: return GL_RGB8_OES;
- case D3DFMT_D16: return GL_DEPTH_COMPONENT16;
- case D3DFMT_D24S8: return GL_DEPTH24_STENCIL8_OES;
- case D3DFMT_UNKNOWN: return GL_NONE;
- case D3DFMT_DXT1: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- case D3DFMT_DXT3: return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
- case D3DFMT_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
- case D3DFMT_A32B32G32R32F: return GL_RGBA32F_EXT;
- case D3DFMT_A16B16G16R16F: return GL_RGBA16F_EXT;
- case D3DFMT_L8: return GL_LUMINANCE8_EXT;
- case D3DFMT_A8L8: return GL_LUMINANCE8_ALPHA8_EXT;
- default: UNREACHABLE();
- return GL_NONE;
- }
-}
-
-}
-
-namespace d3d9
-{
-
-bool IsCompressedFormat(D3DFORMAT surfaceFormat)
-{
- switch(surfaceFormat)
- {
- case D3DFMT_DXT1:
- case D3DFMT_DXT2:
- case D3DFMT_DXT3:
- case D3DFMT_DXT4:
- case D3DFMT_DXT5:
- return true;
- default:
- return false;
- }
-}
-
-size_t ComputeRowSize(D3DFORMAT format, unsigned int width)
-{
- if (format == D3DFMT_INTZ)
- {
- return 4 * width;
- }
- switch (format)
- {
- case D3DFMT_L8:
- return 1 * width;
- case D3DFMT_A8L8:
- return 2 * width;
- case D3DFMT_X8R8G8B8:
- case D3DFMT_A8R8G8B8:
- return 4 * width;
- case D3DFMT_A16B16G16R16F:
- return 8 * width;
- case D3DFMT_A32B32G32R32F:
- return 16 * width;
- case D3DFMT_DXT1:
- return 8 * ((width + 3) / 4);
- case D3DFMT_DXT3:
- case D3DFMT_DXT5:
- return 16 * ((width + 3) / 4);
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9renderer9_utilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/renderer9_utils.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,16 +10,16 @@
</span><span class="cx"> #ifndef LIBGLESV2_RENDERER_RENDERER9_UTILS_H
</span><span class="cx"> #define LIBGLESV2_RENDERER_RENDERER9_UTILS_H
</span><span class="cx">
</span><del>-#include "libGLESv2/utilities.h"
</del><ins>+#include "libGLESv2/angletypes.h"
</ins><span class="cx">
</span><del>-const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
-const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
</del><ins>+namespace rx
+{
</ins><span class="cx">
</span><span class="cx"> namespace gl_d3d9
</span><span class="cx"> {
</span><span class="cx">
</span><span class="cx"> D3DCMPFUNC ConvertComparison(GLenum comparison);
</span><del>-D3DCOLOR ConvertColor(gl::Color color);
</del><ins>+D3DCOLOR ConvertColor(gl::ColorF color);
</ins><span class="cx"> D3DBLEND ConvertBlendFunc(GLenum blend);
</span><span class="cx"> D3DBLENDOP ConvertBlendOp(GLenum blendOp);
</span><span class="cx"> D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
</span><span class="lines">@@ -29,31 +29,11 @@
</span><span class="cx"> DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
</span><span class="cx"> D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy);
</span><span class="cx"> void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy);
</span><del>-D3DFORMAT ConvertRenderbufferFormat(GLenum format);
-D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples);
</del><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>-namespace d3d9_gl
-{
-
-GLuint GetAlphaSize(D3DFORMAT colorFormat);
-GLuint GetStencilSize(D3DFORMAT stencilFormat);
-
-GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type);
-
-bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
-GLenum ConvertBackBufferFormat(D3DFORMAT format);
-GLenum ConvertDepthStencilFormat(D3DFORMAT format);
-GLenum ConvertRenderTargetFormat(D3DFORMAT format);
-GLenum GetEquivalentFormat(D3DFORMAT format);
-
-}
-
</del><span class="cx"> namespace d3d9
</span><span class="cx"> {
</span><del>-bool IsCompressedFormat(D3DFORMAT format);
-size_t ComputeRowSize(D3DFORMAT format, unsigned int width);
</del><span class="cx">
</span><span class="cx"> inline bool isDeviceLostError(HRESULT errorCode)
</span><span class="cx"> {
</span><span class="lines">@@ -71,4 +51,6 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+}
+
</ins><span class="cx"> #endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shadersBlitps"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/Blit.ps (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/Blit.ps        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/Blit.ps        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -6,34 +6,28 @@
</span><span class="cx">
</span><span class="cx"> sampler2D tex : s0;
</span><span class="cx">
</span><del>-uniform float4 mode : c0;
</del><ins>+uniform float4 mult : c0;
+uniform float4 add : c1;
</ins><span class="cx">
</span><span class="cx"> // Passthrough Pixel Shader
</span><span class="cx"> // Outputs texture 0 sampled at texcoord 0.
</span><span class="cx"> float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
</span><span class="cx"> {
</span><del>-        return tex2D(tex, texcoord.xy);
</del><ins>+ return tex2D(tex, texcoord.xy);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> // Luminance Conversion Pixel Shader
</span><del>-// Outputs sample(tex0, tc0).rrra.
-// For LA output (pass A) set C0.X = 1, C0.Y = 0.
-// For L output (A = 1) set C0.X = 0, C0.Y = 1.
</del><ins>+// Performs a mad operation using the LA data from the texture with mult.xw and add.xw.
+// Returns data in the form of llla
</ins><span class="cx"> float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
</span><span class="cx"> {
</span><del>-        float4 tmp = tex2D(tex, texcoord.xy);
-        tmp.w = tmp.w * mode.x + mode.y;
-        return tmp.xxxw;
</del><ins>+ return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> // RGB/A Component Mask Pixel Shader
</span><del>-// Outputs sample(tex0, tc0) with options to force RGB = 0 and/or A = 1.
-// To force RGB = 0, set C0.X = 0, otherwise C0.X = 1.
-// To force A = 1, set C0.Z = 0, C0.W = 1, otherwise C0.Z = 1, C0.W = 0.
</del><ins>+// Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw.
+// Returns data in the form of rgba
</ins><span class="cx"> float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
</span><span class="cx"> {
</span><del>-        float4 tmp = tex2D(tex, texcoord.xy);
-        tmp.xyz = tmp.xyz * mode.x;
-        tmp.w = tmp.w * mode.z + mode.w;
-        return tmp;
</del><ins>+ return tex2D(tex, texcoord.xy) * mult + add;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledcomponentmaskpsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,79 +1,85 @@
</span><del>-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-///
-// Parameters:
-//
-// float4 mode;
-// sampler2D tex;
-//
-//
-// Registers:
-//
-// Name Reg Size
-// ------------ ----- ----
-// mode c0 1
-// tex s0 1
-//
-
- ps_2_0
- dcl t0.xy
- dcl_2d s0
- texld r0, t0, s0
- mul r1.xyz, r0, c0.x
- mad r1.w, r0.w, c0.z, c0.w
- mov oC0, r1
-
-// approximately 4 instruction slots used (1 texture, 3 arithmetic)
-#endif
-
-const BYTE g_ps20_componentmaskps[] =
-{
- 0, 2, 255, 255, 254, 255,
- 44, 0, 67, 84, 65, 66,
- 28, 0, 0, 0, 119, 0,
- 0, 0, 0, 2, 255, 255,
- 2, 0, 0, 0, 28, 0,
- 0, 0, 0, 1, 0, 0,
- 112, 0, 0, 0, 68, 0,
- 0, 0, 2, 0, 0, 0,
- 1, 0, 0, 0, 76, 0,
- 0, 0, 0, 0, 0, 0,
- 92, 0, 0, 0, 3, 0,
- 0, 0, 1, 0, 0, 0,
- 96, 0, 0, 0, 0, 0,
- 0, 0, 109, 111, 100, 101,
- 0, 171, 171, 171, 1, 0,
- 3, 0, 1, 0, 4, 0,
- 1, 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, 57, 46,
- 51, 48, 46, 57, 50, 48,
- 48, 46, 49, 54, 51, 56,
- 52, 0, 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, 5, 0, 0, 3,
- 1, 0, 7, 128, 0, 0,
- 228, 128, 0, 0, 0, 160,
- 4, 0, 0, 4, 1, 0,
- 8, 128, 0, 0, 255, 128,
- 0, 0, 170, 160, 0, 0,
- 255, 160, 1, 0, 0, 2,
- 0, 8, 15, 128, 1, 0,
- 228, 128, 255, 255, 0, 0
-};
</del><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46,
+ 51, 48, 46, 57, 50, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52, 0, 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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledflipyvsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,67 +1,67 @@
</span><del>-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46, 51, 48,
- 46, 57, 50, 48, 48, 46,
- 49, 54, 51, 56, 52, 0,
- 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
-};
</del><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledluminancepsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,79 +1,95 @@
</span><del>-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-///
-// Parameters:
-//
-// float4 mode;
-// sampler2D tex;
-//
-//
-// Registers:
-//
-// Name Reg Size
-// ------------ ----- ----
-// mode c0 1
-// tex s0 1
-//
-
- ps_2_0
- dcl t0.xy
- dcl_2d s0
- texld r0, t0, s0
- mad r1.w, r0.w, c0.x, c0.y
- mov r1.xyz, r0.x
- mov oC0, r1
-
-// approximately 4 instruction slots used (1 texture, 3 arithmetic)
-#endif
-
-const BYTE g_ps20_luminanceps[] =
-{
- 0, 2, 255, 255, 254, 255,
- 44, 0, 67, 84, 65, 66,
- 28, 0, 0, 0, 119, 0,
- 0, 0, 0, 2, 255, 255,
- 2, 0, 0, 0, 28, 0,
- 0, 0, 0, 1, 0, 0,
- 112, 0, 0, 0, 68, 0,
- 0, 0, 2, 0, 0, 0,
- 1, 0, 0, 0, 76, 0,
- 0, 0, 0, 0, 0, 0,
- 92, 0, 0, 0, 3, 0,
- 0, 0, 1, 0, 0, 0,
- 96, 0, 0, 0, 0, 0,
- 0, 0, 109, 111, 100, 101,
- 0, 171, 171, 171, 1, 0,
- 3, 0, 1, 0, 4, 0,
- 1, 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, 57, 46,
- 51, 48, 46, 57, 50, 48,
- 48, 46, 49, 54, 51, 56,
- 52, 0, 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, 4, 0, 0, 4,
- 1, 0, 8, 128, 0, 0,
- 255, 128, 0, 0, 0, 160,
- 0, 0, 85, 160, 1, 0,
- 0, 2, 1, 0, 7, 128,
- 0, 0, 0, 128, 1, 0,
- 0, 2, 0, 8, 15, 128,
- 1, 0, 228, 128, 255, 255,
- 0, 0
-};
</del><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46,
+ 51, 48, 46, 57, 50, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52, 0, 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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledpassthroughpsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,62 +1,62 @@
</span><del>-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46, 51, 48,
- 46, 57, 50, 48, 48, 46,
- 49, 54, 51, 56, 52, 0,
- 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
-};
</del><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shaderscompiledstandardvsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,67 +1,67 @@
</span><del>-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46, 51, 48,
- 46, 57, 50, 48, 48, 46,
- 49, 54, 51, 56, 52, 0,
- 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
-};
</del><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.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, 57, 46, 51, 48,
+ 46, 57, 50, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 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="trunkSourceThirdPartyANGLEsrclibGLESv2rendererd3d9shadersgenerate_shadersbat"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/d3d9/shaders/generate_shaders.bat        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,14 +1,63 @@
</span><span class="cx"> @ECHO OFF
</span><span class="cx"> REM
</span><del>-REM Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
</del><ins>+REM Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> REM Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> REM found in the LICENSE file.
</span><span class="cx"> REM
</span><span class="cx">
</span><span class="cx"> PATH %PATH%;%ProgramFiles(x86)%\Windows Kits\8.0\bin\x86;%DXSDK_DIR%\Utilities\bin\x86
</span><span class="cx">
</span><del>-fxc /E standardvs /T vs_2_0 /Fh compiled/standardvs.h Blit.vs
-fxc /E flipyvs /T vs_2_0 /Fh compiled/flipyvs.h Blit.vs
-fxc /E passthroughps /T ps_2_0 /Fh compiled/passthroughps.h Blit.ps
-fxc /E luminanceps /T ps_2_0 /Fh compiled/luminanceps.h Blit.ps
-fxc /E componentmaskps /T ps_2_0 /Fh compiled/componentmaskps.h Blit.ps
</del><ins>+setlocal
+set errorCount=0
+set successCount=0
+set debug=0
+
+if "%1" == "debug" (
+ set debug=1
+)
+if "%1" == "release" (
+ 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 "buildCMD=fxc /nologo /E %entry% /T %type% /Fh %output% %input%"
+) else (
+ set "buildCMD=fxc /nologo /Zi /Od /E %entry% /T %type% /Fh %output% %input%"
+)
+
+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="trunkSourceThirdPartyANGLEsrclibGLESv2renderergeneratemiph"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/generatemip.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/generatemip.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/generatemip.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -10,194 +10,260 @@
</span><span class="cx"> #ifndef LIBGLESV2_RENDERER_GENERATEMIP_H_
</span><span class="cx"> #define LIBGLESV2_RENDERER_GENERATEMIP_H_
</span><span class="cx">
</span><del>-#include "libGLESv2/mathutil.h"
</del><ins>+#include "common/mathutil.h"
+#include "imageformats.h"
</ins><span class="cx">
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><del>-struct L8
</del><ins>+
+namespace priv
</ins><span class="cx"> {
</span><del>- unsigned char L;
</del><span class="cx">
</span><del>- static void average(L8 *dst, const L8 *src1, const L8 *src2)
- {
- dst->L = ((src1->L ^ src2->L) >> 1) + (src1->L & src2->L);
- }
-};
</del><ins>+template <typename T>
+static inline T *GetPixel(void *data, unsigned int x, unsigned int y, unsigned int z, unsigned int rowPitch, unsigned int depthPitch)
+{
+ return reinterpret_cast<T*>(reinterpret_cast<unsigned char*>(data) + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
</ins><span class="cx">
</span><del>-typedef L8 R8; // R8 type is functionally equivalent for mip purposes
-typedef L8 A8; // A8 type is functionally equivalent for mip purposes
</del><ins>+template <typename T>
+static inline const T *GetPixel(const void *data, unsigned int x, unsigned int y, unsigned int z, unsigned int rowPitch, unsigned int depthPitch)
+{
+ return reinterpret_cast<const T*>(reinterpret_cast<const unsigned char*>(data) + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
</ins><span class="cx">
</span><del>-struct A8L8
</del><ins>+template <typename T>
+static void GenerateMip_Y(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
</ins><span class="cx"> {
</span><del>- unsigned char L;
- unsigned char A;
</del><ins>+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth == 1);
</ins><span class="cx">
</span><del>- static void average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2)
</del><ins>+ for (unsigned int y = 0; y < destHeight; y++)
</ins><span class="cx"> {
</span><del>- *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) & 0xFEFE) >> 1) + (*(unsigned short*)src1 & *(unsigned short*)src2);
</del><ins>+ const T *src0 = GetPixel<T>(sourceData, 0, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, 0, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, 0, y, 0, destRowPitch, destDepthPitch);
+
+ T::average(dst, src0, src1);
</ins><span class="cx"> }
</span><del>-};
</del><ins>+}
</ins><span class="cx">
</span><del>-typedef A8L8 R8G8; // R8G8 type is functionally equivalent for mip purposes
-
-struct A8R8G8B8
</del><ins>+template <typename T>
+static void GenerateMip_X(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
</ins><span class="cx"> {
</span><del>- unsigned char B;
- unsigned char G;
- unsigned char R;
- unsigned char A;
</del><ins>+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth == 1);
</ins><span class="cx">
</span><del>- static void average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2)
</del><ins>+ for (unsigned int x = 0; x < destWidth; x++)
</ins><span class="cx"> {
</span><del>- *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) & 0xFEFEFEFE) >> 1) + (*(unsigned int*)src1 & *(unsigned int*)src2);
</del><ins>+ const T *src0 = GetPixel<T>(sourceData, x * 2, 0, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2 + 1, 0, 0, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, 0, 0, destRowPitch, destDepthPitch);
+
+ T::average(dst, src0, src1);
</ins><span class="cx"> }
</span><del>-};
</del><ins>+}
</ins><span class="cx">
</span><del>-typedef A8R8G8B8 R8G8B8A8; // R8G8B8A8 type is functionally equivalent for mip purposes
-
-struct A16B16G16R16F
</del><ins>+template <typename T>
+static void GenerateMip_Z(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
</ins><span class="cx"> {
</span><del>- unsigned short R;
- unsigned short G;
- unsigned short B;
- unsigned short A;
</del><ins>+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth > 1);
</ins><span class="cx">
</span><del>- static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2)
</del><ins>+ for (unsigned int z = 0; z < destDepth; z++)
</ins><span class="cx"> {
</span><del>- dst->R = gl::float32ToFloat16((gl::float16ToFloat32(src1->R) + gl::float16ToFloat32(src2->R)) * 0.5f);
- dst->G = gl::float32ToFloat16((gl::float16ToFloat32(src1->G) + gl::float16ToFloat32(src2->G)) * 0.5f);
- dst->B = gl::float32ToFloat16((gl::float16ToFloat32(src1->B) + gl::float16ToFloat32(src2->B)) * 0.5f);
- dst->A = gl::float32ToFloat16((gl::float16ToFloat32(src1->A) + gl::float16ToFloat32(src2->A)) * 0.5f);
</del><ins>+ const T *src0 = GetPixel<T>(sourceData, 0, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, 0, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, 0, 0, z, destRowPitch, destDepthPitch);
+
+ T::average(dst, src0, src1);
</ins><span class="cx"> }
</span><del>-};
</del><ins>+}
</ins><span class="cx">
</span><del>-struct R16F
</del><ins>+template <typename T>
+static void GenerateMip_XY(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
</ins><span class="cx"> {
</span><del>- unsigned short R;
</del><ins>+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth == 1);
</ins><span class="cx">
</span><del>- static void average(R16F *dst, const R16F *src1, const R16F *src2)
</del><ins>+ for (unsigned int y = 0; y < destHeight; y++)
</ins><span class="cx"> {
</span><del>- dst->R = gl::float32ToFloat16((gl::float16ToFloat32(src1->R) + gl::float16ToFloat32(src2->R)) * 0.5f);
- }
-};
</del><ins>+ for (unsigned int x = 0; x < destWidth; x++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, x * 2, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, y, 0, destRowPitch, destDepthPitch);
</ins><span class="cx">
</span><del>-struct R16G16F
-{
- unsigned short R;
- unsigned short G;
</del><ins>+ T tmp0, tmp1;
</ins><span class="cx">
</span><del>- static void average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2)
- {
- dst->R = gl::float32ToFloat16((gl::float16ToFloat32(src1->R) + gl::float16ToFloat32(src2->R)) * 0.5f);
- dst->G = gl::float32ToFloat16((gl::float16ToFloat32(src1->G) + gl::float16ToFloat32(src2->G)) * 0.5f);
</del><ins>+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
</ins><span class="cx"> }
</span><del>-};
</del><ins>+}
</ins><span class="cx">
</span><del>-struct A32B32G32R32F
</del><ins>+template <typename T>
+static void GenerateMip_YZ(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
</ins><span class="cx"> {
</span><del>- float R;
- float G;
- float B;
- float A;
</del><ins>+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth > 1);
</ins><span class="cx">
</span><del>- static void average(A32B32G32R32F *dst, const A32B32G32R32F *src1, const A32B32G32R32F *src2)
</del><ins>+ for (unsigned int z = 0; z < destDepth; z++)
</ins><span class="cx"> {
</span><del>- dst->R = (src1->R + src2->R) * 0.5f;
- dst->G = (src1->G + src2->G) * 0.5f;
- dst->B = (src1->B + src2->B) * 0.5f;
- dst->A = (src1->A + src2->A) * 0.5f;
- }
-};
</del><ins>+ for (unsigned int y = 0; y < destHeight; y++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, 0, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, 0, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, 0, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, 0, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, 0, y, z, destRowPitch, destDepthPitch);
</ins><span class="cx">
</span><del>-struct R32F
-{
- float R;
</del><ins>+ T tmp0, tmp1;
</ins><span class="cx">
</span><del>- static void average(R32F *dst, const R32F *src1, const R32F *src2)
- {
- dst->R = (src1->R + src2->R) * 0.5f;
</del><ins>+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
</ins><span class="cx"> }
</span><del>-};
</del><ins>+}
</ins><span class="cx">
</span><del>-struct R32G32F
</del><ins>+template <typename T>
+static void GenerateMip_XZ(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
</ins><span class="cx"> {
</span><del>- float R;
- float G;
</del><ins>+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth > 1);
</ins><span class="cx">
</span><del>- static void average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2)
</del><ins>+ for (unsigned int z = 0; z < destDepth; z++)
</ins><span class="cx"> {
</span><del>- dst->R = (src1->R + src2->R) * 0.5f;
- dst->G = (src1->G + src2->G) * 0.5f;
- }
-};
</del><ins>+ for (unsigned int x = 0; x < destWidth; x++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, x * 2, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, x * 2 + 1, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, x * 2 + 1, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, 0, z, destRowPitch, destDepthPitch);
</ins><span class="cx">
</span><del>-struct R32G32B32F
-{
- float R;
- float G;
- float B;
</del><ins>+ T tmp0, tmp1;
</ins><span class="cx">
</span><del>- static void average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2)
- {
- dst->R = (src1->R + src2->R) * 0.5f;
- dst->G = (src1->G + src2->G) * 0.5f;
- dst->B = (src1->B + src2->B) * 0.5f;
</del><ins>+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
</ins><span class="cx"> }
</span><del>-};
</del><ins>+}
</ins><span class="cx">
</span><span class="cx"> template <typename T>
</span><del>-static void GenerateMip(unsigned int sourceWidth, unsigned int sourceHeight,
- const unsigned char *sourceData, int sourcePitch,
- unsigned char *destData, int destPitch)
</del><ins>+static void GenerateMip_XYZ(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
</ins><span class="cx"> {
</span><del>- unsigned int mipWidth = std::max(1U, sourceWidth >> 1);
- unsigned int mipHeight = std::max(1U, sourceHeight >> 1);
</del><ins>+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth > 1);
</ins><span class="cx">
</span><del>- if (sourceHeight == 1)
</del><ins>+ for (unsigned int z = 0; z < destDepth; z++)
</ins><span class="cx"> {
</span><del>- ASSERT(sourceWidth != 1);
</del><ins>+ for (unsigned int y = 0; y < destHeight; y++)
+ {
+ for (unsigned int x = 0; x < destWidth; x++)
+ {
+ const T *src0 = GetPixel<T>(sourceData, x * 2, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src1 = GetPixel<T>(sourceData, x * 2, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src2 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src3 = GetPixel<T>(sourceData, x * 2, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src4 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src5 = GetPixel<T>(sourceData, x * 2 + 1, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ const T *src6 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+ const T *src7 = GetPixel<T>(sourceData, x * 2 + 1, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+ T *dst = GetPixel<T>(destData, x, y, z, destRowPitch, destDepthPitch);
</ins><span class="cx">
</span><del>- const T *src = (const T*)sourceData;
- T *dst = (T*)destData;
</del><ins>+ T tmp0, tmp1, tmp2, tmp3, tmp4, tmp5;
</ins><span class="cx">
</span><del>- for (unsigned int x = 0; x < mipWidth; x++)
- {
- T::average(&dst[x], &src[x * 2], &src[x * 2 + 1]);
- }
- }
- else if (sourceWidth == 1)
- {
- ASSERT(sourceHeight != 1);
</del><ins>+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(&tmp2, src4, src5);
+ T::average(&tmp3, src6, src7);
</ins><span class="cx">
</span><del>- for (unsigned int y = 0; y < mipHeight; y++)
- {
- const T *src0 = (const T*)(sourceData + y * 2 * sourcePitch);
- const T *src1 = (const T*)(sourceData + y * 2 * sourcePitch + sourcePitch);
- T *dst = (T*)(destData + y * destPitch);
</del><ins>+ T::average(&tmp4, &tmp0, &tmp1);
+ T::average(&tmp5, &tmp2, &tmp3);
</ins><span class="cx">
</span><del>- T::average(dst, src0, src1);
</del><ins>+ T::average(dst, &tmp4, &tmp5);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- else
- {
- for (unsigned int y = 0; y < mipHeight; y++)
- {
- const T *src0 = (const T*)(sourceData + y * 2 * sourcePitch);
- const T *src1 = (const T*)(sourceData + y * 2 * sourcePitch + sourcePitch);
- T *dst = (T*)(destData + y * destPitch);
</del><ins>+}
</ins><span class="cx">
</span><del>- for (unsigned int x = 0; x < mipWidth; x++)
- {
- T tmp0;
- T tmp1;
</del><span class="cx">
</span><del>- T::average(&tmp0, &src0[x * 2], &src0[x * 2 + 1]);
- T::average(&tmp1, &src1[x * 2], &src1[x * 2 + 1]);
- T::average(&dst[x], &tmp0, &tmp1);
- }
- }
</del><ins>+typedef void (*MipGenerationFunction)(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned int destWidth, unsigned int destHeight, unsigned int destDepth,
+ unsigned char *destData, int destRowPitch, int destDepthPitch);
+
+template <typename T>
+static MipGenerationFunction GetMipGenerationFunction(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth)
+{
+ unsigned char index = ((sourceWidth > 1) ? 1 : 0) |
+ ((sourceHeight > 1) ? 2 : 0) |
+ ((sourceDepth > 1) ? 4 : 0);
+
+ switch (index)
+ {
+ case 1: return GenerateMip_X<T>; // W x 1 x 1
+ case 2: return GenerateMip_Y<T>; // 1 x H x 1
+ case 3: return GenerateMip_XY<T>; // W x H x 1
+ case 4: return GenerateMip_Z<T>; // 1 x 1 x D
+ case 5: return GenerateMip_XZ<T>; // W x 1 x D
+ case 6: return GenerateMip_YZ<T>; // 1 x H x D
+ case 7: return GenerateMip_XYZ<T>; // W x H x D
+ default: return NULL;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+template <typename T>
+static void GenerateMip(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
+ const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
+ unsigned char *destData, int destRowPitch, int destDepthPitch)
+{
+ unsigned int mipWidth = std::max(1U, sourceWidth >> 1);
+ unsigned int mipHeight = std::max(1U, sourceHeight >> 1);
+ unsigned int mipDepth = std::max(1U, sourceDepth >> 1);
+
+ priv::MipGenerationFunction generationFunction = priv::GetMipGenerationFunction<T>(sourceWidth, sourceHeight, sourceDepth);
+ ASSERT(generationFunction != NULL);
+
+ generationFunction(sourceWidth, sourceHeight, sourceDepth, sourceData, sourceRowPitch, sourceDepthPitch,
+ mipWidth, mipHeight, mipDepth, destData, destRowPitch, destDepthPitch);
+}
+
+}
+
</ins><span class="cx"> #endif // LIBGLESV2_RENDERER_GENERATEMIP_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partycompilerArrayBoundsClamperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/third_party/compiler/ArrayBoundsClamper.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/compiler/ArrayBoundsClamper.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/compiler/ArrayBoundsClamper.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -26,8 +26,6 @@
</span><span class="cx"> #ifndef THIRD_PARTY_COMPILER_ARRAY_BOUNDS_CLAMPER_H_
</span><span class="cx"> #define THIRD_PARTY_COMPILER_ARRAY_BOUNDS_CLAMPER_H_
</span><span class="cx">
</span><del>-#include "GLSLANG/ShaderLang.h"
-
</del><span class="cx"> #include "compiler/translator/InfoSink.h"
</span><span class="cx"> #include "compiler/translator/intermediate.h"
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partymurmurhashMurmurHash3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -16,20 +16,20 @@
</span><span class="cx">
</span><span class="cx"> #if defined(_MSC_VER)
</span><span class="cx">
</span><del>-#define FORCE_INLINE __forceinline
</del><ins>+#define FORCE_INLINE        __forceinline
</ins><span class="cx">
</span><span class="cx"> #include <stdlib.h>
</span><span class="cx">
</span><del>-#define ROTL32(x,y) _rotl(x,y)
-#define ROTL64(x,y) _rotl64(x,y)
</del><ins>+#define ROTL32(x,y)        _rotl(x,y)
+#define ROTL64(x,y)        _rotl64(x,y)
</ins><span class="cx">
</span><span class="cx"> #define BIG_CONSTANT(x) (x)
</span><span class="cx">
</span><span class="cx"> // Other compilers
</span><span class="cx">
</span><del>-#else // defined(_MSC_VER)
</del><ins>+#else        // defined(_MSC_VER)
</ins><span class="cx">
</span><del>-#define FORCE_INLINE __attribute__((always_inline))
</del><ins>+#define        FORCE_INLINE __attribute__((always_inline))
</ins><span class="cx">
</span><span class="cx"> inline uint32_t rotl32 ( uint32_t x, int8_t r )
</span><span class="cx"> {
</span><span class="lines">@@ -41,8 +41,8 @@
</span><span class="cx"> return (x << r) | (x >> (64 - r));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#define ROTL32(x,y) rotl32(x,y)
-#define ROTL64(x,y) rotl64(x,y)
</del><ins>+#define        ROTL32(x,y)        rotl32(x,y)
+#define ROTL64(x,y)        rotl64(x,y)
</ins><span class="cx">
</span><span class="cx"> #define BIG_CONSTANT(x) (x##LLU)
</span><span class="cx">
</span><span class="cx">Property changes on: trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partymurmurhashMurmurHash3h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -8,22 +8,8 @@
</span><span class="cx"> //-----------------------------------------------------------------------------
</span><span class="cx"> // Platform-specific functions and macros
</span><span class="cx">
</span><del>-// Microsoft Visual Studio
-
-#if defined(_MSC_VER)
-
-typedef unsigned char uint8_t;
-typedef unsigned long uint32_t;
-typedef unsigned __int64 uint64_t;
-
-// Other compilers
-
-#else // defined(_MSC_VER)
-
</del><span class="cx"> #include <stdint.h>
</span><span class="cx">
</span><del>-#endif // !defined(_MSC_VER)
-
</del><span class="cx"> //-----------------------------------------------------------------------------
</span><span class="cx">
</span><span class="cx"> void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out );
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -3019,6 +3019,14 @@
</span><span class="cx"> endif ()
</span><span class="cx">
</span><span class="cx"> list(APPEND ANGLESupport_SOURCES
</span><ins>+ ${THIRDPARTY_DIR}/ANGLE/src/common/blocklayout.cpp
+ ${THIRDPARTY_DIR}/ANGLE/src/common/debug.cpp
+ ${THIRDPARTY_DIR}/ANGLE/src/common/event_tracer.cpp
+ ${THIRDPARTY_DIR}/ANGLE/src/common/mathutil.cpp
+ ${THIRDPARTY_DIR}/ANGLE/src/common/RefCountObject.cpp
+ ${THIRDPARTY_DIR}/ANGLE/src/common/shadervars.cpp
+ ${THIRDPARTY_DIR}/ANGLE/src/common/utilities.cpp
+
</ins><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/CodeGen.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Compiler.cpp
</span><span class="lines">@@ -3027,6 +3035,7 @@
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Diagnostics.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/DirectiveHandler.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ForLoopUnroll.cpp
</span><ins>+ ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/FlagStd140Structs.cpp
</ins><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/InfoSink.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Initialize.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/InitializeDll.cpp
</span><span class="lines">@@ -3035,7 +3044,7 @@
</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><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Intermediate.cpp
</span><del>- ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/MapLongVariableNames.cpp
</del><ins>+ ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/LoopInfo.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="lines">@@ -3054,6 +3063,7 @@
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/UnfoldShortCircuit.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp
</span><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Uniform.cpp
</span><ins>+ ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ValidateOutputs.cpp
</ins><span class="cx"> ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ValidateLimitations.cpp
</span><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></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/WebCore/ChangeLog        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-04-30 Alex Christensen <achristensen@webkit.org>
+
+ Updated ANGLE.
+ https://bugs.webkit.org/show_bug.cgi?id=132367
+ <rdar://problem/16211451>
+
+ Reviewed by Dean Jackson.
+
+ * CMakeLists.txt
+ Fixed ANGLE compiling with the update.
+ * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
+ (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
+ Removed SH_MAP_LONG_VARIABLE_NAMES which is no longer defined in ANGLE.
+ See https://chromium.googlesource.com/angle/angle/+/3cdfcce86b38ef31a0afd71855887193a7924468
+ * platform/graphics/opengl/Extensions3DOpenGLES.h:
+ * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
+ Updated type names from ANGLE.
+
</ins><span class="cx"> 2014-04-30 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Move Blob.slice() implementation into BlobRegistryImpl
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLCommoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -179,7 +179,7 @@
</span><span class="cx">
</span><span class="cx"> String translatedShaderSource;
</span><span class="cx"> String shaderInfoLog;
</span><del>- int extraCompileOptions = SH_MAP_LONG_VARIABLE_NAMES | SH_CLAMP_INDIRECT_ARRAY_BOUNDS | SH_UNFOLD_SHORT_CIRCUIT | SH_ENFORCE_PACKING_RESTRICTIONS | SH_INIT_VARYINGS_WITHOUT_STATIC_USE;
</del><ins>+ int extraCompileOptions = SH_CLAMP_INDIRECT_ARRAY_BOUNDS | SH_UNFOLD_SHORT_CIRCUIT | SH_ENFORCE_PACKING_RESTRICTIONS | SH_INIT_VARYINGS_WITHOUT_STATIC_USE;
</ins><span class="cx">
</span><span class="cx"> if (m_requiresBuiltInFunctionEmulation)
</span><span class="cx"> extraCompileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLEScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -272,8 +272,8 @@
</span><span class="cx"> m_glIsVertexArrayOES = reinterpret_cast<PFNGLISVERTEXARRAYOESPROC>(eglGetProcAddress("glIsVertexArrayOES"));
</span><span class="cx"> m_supportsOESvertexArrayObject = true;
</span><span class="cx"> } else if (!m_supportsIMGMultisampledRenderToTexture && name == "GL_IMG_multisampled_render_to_texture") {
</span><del>- m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"));
- m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG"));
</del><ins>+ m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"));
+ m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG"));
</ins><span class="cx"> m_supportsIMGMultisampledRenderToTexture = true;
</span><span class="cx"> } else if (!m_glGetGraphicsResetStatusEXT && name == "GL_EXT_robustness") {
</span><span class="cx"> m_glGetGraphicsResetStatusEXT = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSEXTPROC>(eglGetProcAddress("glGetGraphicsResetStatusEXT"));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLESh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h (168054 => 168055)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h        2014-04-30 22:52:30 UTC (rev 168054)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h        2014-04-30 22:57:08 UTC (rev 168055)
</span><span class="lines">@@ -106,8 +106,8 @@
</span><span class="cx"> bool m_supportsIMGMultisampledRenderToTexture;
</span><span class="cx"> bool m_supportsANGLEinstancedArrays;
</span><span class="cx">
</span><del>- PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG m_glFramebufferTexture2DMultisampleIMG;
- PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG m_glRenderbufferStorageMultisampleIMG;
</del><ins>+ PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC m_glFramebufferTexture2DMultisampleIMG;
+ PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC m_glRenderbufferStorageMultisampleIMG;
</ins><span class="cx"> PFNGLBINDVERTEXARRAYOESPROC m_glBindVertexArrayOES;
</span><span class="cx"> PFNGLDELETEVERTEXARRAYSOESPROC m_glDeleteVertexArraysOES;
</span><span class="cx"> PFNGLGENVERTEXARRAYSOESPROC m_glGenVertexArraysOES;
</span></span></pre>
</div>
</div>
</body>
</html>